node.js - 为什么 npm start 给我一个错误并且无法启动本地服务器?
问题描述
我正在尝试使用节点 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
推荐阅读
- ruby-on-rails - 为什么另一个类引用的类不需要导入?
- r - R 的代码,用于从均匀随机数中获取遵循卡方分布的直方图
- ios - 如何在 SwiftUI 中创建自定义 ListStyle?
- c# - C# 无法从字符串属性中获取字符
- node.js - 无法从我的 Nodejs 应用程序连接 Elasticsearch:连接 ECONNREFUSED 127.0.0.1:9200
- android-studio - 无法关闭自定义 AlertDialog
- javascript - 如何仅为特定构建制作 webpack 导入 polyfill?
- r - 如何根据符号转换数据框中的段落列表?
- r - 我想使用 for 循环打印我的 tibble 的平均值和名称
- java - Java中的文字字符串只存储在字符串常量池中?