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

标签 node.js linux reactjs npm debian-stretch

我正在尝试使用 Node js 启动本地服务器,我已经执行了 create-react-app 并且文件已在文件夹中成功创建,但是当我尝试执行 npm start 时它显示错误。我在 debian 9 上,我在 Windows 上有同样的错误。这是调试日志

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 Node 版本解决了这个问题。我正在使用 Node 12

关于node.js - 为什么 npm start 给我一个错误并且无法启动本地服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55885454/

相关文章:

javascript - 无法读取未定义的属性 "toFixed"

javascript - JS 类中需要

javascript - Koa.js - 提供静态文件和 REST API

javascript - 如何在 Node.js 中解析 "Cannot read property of undefined"

regex - Unix:重命名具有动态扩展名的文件

linux - ffmpeg 序列从 30 开始,并在每个图像名称中添加 30

javascript - 模拟调用 'deals.insert'错误效果时出现异常

javascript - mysql/node.js 如何使/假同步?

linux - 将值从 1 列复制到另一列

Webstorm 中的 CoffeeScript-React (.cjsx) 支持