React 应用程序不使用 npm start 启动服务器
React app does not start server with npm start
我使用 CRA 创建了一个新的 React 应用程序。我一启动开发服务器,它就抛出错误并退出。
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! cart-redux@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cart-redux@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logg
ing output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs19-05-26T09_32_50_014Z
-debug.log
react-scripts 版本 3.0.1 正在避免 'npm start'。我尝试降级到 2.1.8 版,它工作正常。但我不想每次都降级版本以使我的应用程序正常工作。
,但没有帮助。
其他人遇到这个问题,请帮忙解决。
如果您尝试了 但它对您不起作用,那么这可能是一个 react-scripts 问题,因此要修复它,请尝试以下操作:
remove node_modules and lock files
edit package.json so the version of react-scripts is "2.1.8"
npm install
npm start
LTK 进展如何
我使用 CRA 创建了一个新的 React 应用程序。我一启动开发服务器,它就抛出错误并退出。
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! cart-redux@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cart-redux@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logg
ing output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs19-05-26T09_32_50_014Z
-debug.log
react-scripts 版本 3.0.1 正在避免 'npm start'。我尝试降级到 2.1.8 版,它工作正常。但我不想每次都降级版本以使我的应用程序正常工作。
如果您尝试了
remove node_modules and lock files
edit package.json so the version of react-scripts is "2.1.8"
npm install
npm start
LTK 进展如何