【发布时间】:2020-01-12 09:43:00
【问题描述】:
我刚刚创建了一个 react js 项目。然后我运行“npm start”来运行项目。这个错误来了,我现在被困在这里 1 天。我已经有其他 reactJS 项目。所有其他项目都出现此错误。这就是为什么我在新项目中尝试它的原因。所以我通过创建新项目来确认。错误不在我的项目中。
我已经试过了。
- 删除 node_module 文件夹然后 npm install
- 清除节点缓存。
- 重新安装node.js
- 创建新项目。
- 降低'react-script'的版本
- 卸载node.js并删除c盘所有名为“node”的文件
- 安装旧版本的 node.js
错误是,
C:\Suranga\ReactJS\JMSL\my_app>npm start
> my_app@0.1.0 start C:\Suranga\ReactJS\JMSL\my_app
> react-scripts start
> Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my_app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my_app@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! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-09-10T15_10_01_727Z-debug.log
C:\Suranga\ReactJS\JMSL\my_app>
【问题讨论】:
-
你能在codesandbox.io 中复制这个吗?
-
events.js:174这个文件的内容是什么? -
这CRA github issue 有帮助吗?
-
检查您的环境变量 PATH。见stackoverflow.com/a/28626189/12030751
-
@It'sNotMe 谢谢。我从这个链接得到了解决方案。我运行“npm install react-scripts@2.1.8”和 npm start。现在它工作正常。
标签: node.js reactjs npm npm-start