gpt4 book ai didi

javascript - 当我执行 npm start 时 react npm 错误 “npm ERR! code ELIFECYCLE”

转载 作者:行者123 更新时间:2023-12-03 23:59:14 25 4
gpt4 key购买 nike

我正在开发一个 React 应用程序。当我使用命令 npm start ,它给出了一个错误。我尝试删除 node_modules 和 package-lock.json 然后执行 npm install .我也试过做npm cache clean --force .我做的最后一件事是npm audit fix .我仍然有同样的问题。这是我的错误:

> majestic-bay@0.1.0 start /home/serg/webdev/majestic-bay
> react-scripts start

/home/serg/webdev/majestic-bay/node_modules/terser-webpack-plugin/node_modules/p-limit/index.js:30
} catch {}
^

SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! majestic-bay@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the majestic-bay@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/serg/.npm/_logs/2020-11-06T06_52_29_568Z-debug.log
这是我的 package.json:
{
"name": "majestic-bay",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
以下是错误文件的内容:
0 info it worked if it ends with ok
1 verbose cli [ '/home/serg/.nvm/versions/node/v9.11.2/bin/node',
1 verbose cli '/home/serg/.nvm/versions/node/v9.11.2/bin/npm',
1 verbose cli 'start' ]
2 info using npm@6.14.8
3 info using node@v9.11.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle majestic-bay@0.1.0~prestart: majestic-bay@0.1.0
6 info lifecycle majestic-bay@0.1.0~start: majestic-bay@0.1.0
7 verbose lifecycle majestic-bay@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle majestic-bay@0.1.0~start: PATH: /home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/serg/webdev/majestic-bay/node_modules/.bin:/home/serg/.nvm/versions/node/v9.11.2/bin:/home/serg/.local/bin:/home/serg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cxoffice/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/opt/cxoffice/bin:/home/serg/.yarn/bin:/home/serg/.yarn/bin
9 verbose lifecycle majestic-bay@0.1.0~start: CWD: /home/serg/webdev/majestic-bay
10 silly lifecycle majestic-bay@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle majestic-bay@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle majestic-bay@0.1.0~start: Failed to exec start script
13 verbose stack Error: majestic-bay@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:180:13)
13 verbose stack at ChildProcess.<anonymous> (/home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:180:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid majestic-bay@0.1.0
15 verbose cwd /home/serg/webdev/majestic-bay
16 verbose Linux 5.8.18-1-MANJARO
17 verbose argv "/home/serg/.nvm/versions/node/v9.11.2/bin/node" "/home/serg/.nvm/versions/node/v9.11.2/bin/npm" "start"
18 verbose node v9.11.2
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error majestic-bay@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the majestic-bay@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

最佳答案

所以,它是 Node 版本。我有 v9.11.2,所以当我安装版本 v12.19.0 时,它修复了它。

关于javascript - 当我执行 npm start 时 react npm 错误 “npm ERR! code ELIFECYCLE”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64710538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com