"npm start" 不适用于新创建的 React 应用程序
"npm start" is not working with newly created react apps
我用npx create-react-app myburger
创建了一个react app,然后通过cd myburger
进入了项目。之后当我 运行 命令 npm start
时,显示以下错误:
$ npm start
> myburger@0.1.0 start E:\front-end projects\burger\myburger
> react-scripts start
Starting the development server...
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn powershell ENOENT
←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)←[39m
←[90m at onErrorNT (internal/child_process.js:469:16)←[39m
←[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m
Emitted 'error' event on ChildProcess instance at:
←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)←[39m
←[90m at onErrorNT (internal/child_process.js:469:16)←[39m
←[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m {
errno: ←[32m'ENOENT'←[39m,
code: ←[32m'ENOENT'←[39m,
syscall: ←[32m'spawn powershell'←[39m,
path: ←[32m'powershell'←[39m,
spawnargs: [
←[32m'-NoProfile'←[39m,
←[32m'-NonInteractive'←[39m,
←[32m'–ExecutionPolicy'←[39m,
←[32m'Bypass'←[39m,
←[32m'-EncodedCommand'←[39m,
←[32m'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'←[39m
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myburger@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myburger@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\User\AppData\Roaming\npm-cache\_logs20-09-08T15_41_32_469Z-debug.log
我以前的所有项目运行都很好。只有我现在正在创建的新的面临这个问题。我在 32 位 windows 7,使用 vscode 和 bash。谁能提供解决方案?
npm install
你安装了所有 npm 模块了吗?请检查您的文件夹。
我尝试了很多方法,唯一对我有用的方法是降级:npm install react-scripts@2.1.8 Tbh 我不知道它为什么起作用
我用npx create-react-app myburger
创建了一个react app,然后通过cd myburger
进入了项目。之后当我 运行 命令 npm start
时,显示以下错误:
$ npm start
> myburger@0.1.0 start E:\front-end projects\burger\myburger
> react-scripts start
Starting the development server...
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn powershell ENOENT
←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)←[39m
←[90m at onErrorNT (internal/child_process.js:469:16)←[39m
←[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m
Emitted 'error' event on ChildProcess instance at:
←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)←[39m
←[90m at onErrorNT (internal/child_process.js:469:16)←[39m
←[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m {
errno: ←[32m'ENOENT'←[39m,
code: ←[32m'ENOENT'←[39m,
syscall: ←[32m'spawn powershell'←[39m,
path: ←[32m'powershell'←[39m,
spawnargs: [
←[32m'-NoProfile'←[39m,
←[32m'-NonInteractive'←[39m,
←[32m'–ExecutionPolicy'←[39m,
←[32m'Bypass'←[39m,
←[32m'-EncodedCommand'←[39m,
←[32m'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'←[39m
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myburger@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myburger@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\User\AppData\Roaming\npm-cache\_logs20-09-08T15_41_32_469Z-debug.log
我以前的所有项目运行都很好。只有我现在正在创建的新的面临这个问题。我在 32 位 windows 7,使用 vscode 和 bash。谁能提供解决方案?
npm install
你安装了所有 npm 模块了吗?请检查您的文件夹。
我尝试了很多方法,唯一对我有用的方法是降级:npm install react-scripts@2.1.8 Tbh 我不知道它为什么起作用