为什么 npm start 给我一个错误并且无法启动本地服务器?
why does npm start gives me an error and cannot launch the local server?
我正在尝试使用节点 js 启动本地服务器,我已经执行了 create-react-app 并且文件已在文件夹中成功创建,但是当我尝试执行 npm start 时它显示错误。我在 debian 9 上,我在 windows 上有同样的错误。这是 debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v12.0.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle freelancer@0.1.0~prestart: freelancer@0.1.0
6 info lifecycle freelancer@0.1.0~start: freelancer@0.1.0
7 verbose lifecycle freelancer@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle freelancer@0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/tony/Programas/Web/freelancer/node_modules/.bin:/home/tony/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle freelancer@0.1.0~start: CWD: /home/tony/Programas/Web/freelancer
10 silly lifecycle freelancer@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle freelancer@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle freelancer@0.1.0~start: Failed to exec start script
13 verbose stack Error: freelancer@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:196:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:196:13)
13 verbose stack at maybeClose (internal/child_process.js:1000:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
14 verbose pkgid freelancer@0.1.0
15 verbose cwd /home/tony/Programas/Web/freelancer
16 verbose Linux 4.9.0-8-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v12.0.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error freelancer@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the freelancer@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 ]
我通过安装 LTS 节点版本解决了这个问题。我正在使用节点 12
我正在尝试使用节点 js 启动本地服务器,我已经执行了 create-react-app 并且文件已在文件夹中成功创建,但是当我尝试执行 npm start 时它显示错误。我在 debian 9 上,我在 windows 上有同样的错误。这是 debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v12.0.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle freelancer@0.1.0~prestart: freelancer@0.1.0
6 info lifecycle freelancer@0.1.0~start: freelancer@0.1.0
7 verbose lifecycle freelancer@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle freelancer@0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/tony/Programas/Web/freelancer/node_modules/.bin:/home/tony/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle freelancer@0.1.0~start: CWD: /home/tony/Programas/Web/freelancer
10 silly lifecycle freelancer@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle freelancer@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle freelancer@0.1.0~start: Failed to exec start script
13 verbose stack Error: freelancer@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:196:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:196:13)
13 verbose stack at maybeClose (internal/child_process.js:1000:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
14 verbose pkgid freelancer@0.1.0
15 verbose cwd /home/tony/Programas/Web/freelancer
16 verbose Linux 4.9.0-8-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v12.0.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error freelancer@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the freelancer@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 ]
我通过安装 LTS 节点版本解决了这个问题。我正在使用节点 12