为什么npm start给我一个错误并且无法启动本地服务器?

时间:2019-04-27 22:35:02

标签: node.js linux reactjs npm debian-stretch

我试图使用节点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 ]

1 个答案:

答案 0 :(得分:0)

我仅通过安装LTS节点版本就解决了它。我正在使用节点12