Luc*_*ens 7 windows node.js git-bash reactjs
我的应用程序有问题。因为之前当我创建一个应用程序时它可以工作,但是现在,它向我显示了这个错误,我不知道为什么以及我必须做些什么来修复它。
你有什么想法可以帮助我吗?(这是一个 reactJS 应用程序)。
我检查了一些 stackoverflow 主题,但在我检查的任何地方,这都不是一个真正有效的答案。
events.js:180
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:3000/' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fix-react-module@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fix-react-module@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\Lucas\AppData\Roaming\npm-cache\_logs\2019-07-16T09_33_39_111Z-debug.log
Run Code Online (Sandbox Code Playgroud)
小智 9
解决方案1
将您的环境变量设置为 C:\Windows\System32 。这对我有用。
解决方案2
如果第一个不起作用,请按照第二个步骤操作。导航到您的项目文件夹并键入此命令 >>>
rm -rf node_modules
rm package-lock.json
rm yarn.lock
npm cache clear --force
npm install
Run Code Online (Sandbox Code Playgroud)
解决方案3
降级 package.json 文件中的 react-scripts
对于所有因反应脚本未启动而遇到此问题的人。解决办法是
C:\Windows\System32
。小智 5
我尝试安装 Mongo DB 后遇到了同样的问题。我发现这个问题只存在于react-scripts@3.0.0。尝试使用不同的 React 脚本版本重新安装 npm。只需转到命令中的文件夹并重新安装,如下所示:
npm install react-scripts@2.1.8
npm start
Run Code Online (Sandbox Code Playgroud)
之后该应用程序再次为我工作。