【发布时间】:2021-06-07 23:57:18
【问题描述】:
当我尝试运行一个简单的npx create-react-app 时,我收到了这个错误:
D:\>npx create-react-app abc
npx: installed 67 in 4.255s
Creating a new React app in D:\abc.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
Aborting installation.
Unexpected error. Please report it as a bug:
Error: spawn UNKNOWN
at ChildProcess.spawn (internal/child_process.js:403:11)
at Object.spawn (child_process.js:553:9)
at spawn (C:\Users\Gilang\AppData\Roaming\npm-cache\_npx\17768\node_modules\create-react-app\node_modules\cross-spawn\index.js:12:24)
at C:\Users\Gilang\AppData\Roaming\npm-cache\_npx\17768\node_modules\create-react-app\createReactApp.js:407:19
at new Promise (<anonymous>)
at install (C:\Users\Gilang\AppData\Roaming\npm-cache\_npx\17768\node_modules\create-react-app\createReactApp.js:359:10)
at C:\Users\Gilang\AppData\Roaming\npm-cache\_npx\17768\node_modules\create-react-app\createReactApp.js:485:16
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'spawn'
}
Deleting generated file... package.json
Deleting abc/ from D:\
Done.
我使用的是 Windows 10 版本 20H2 和节点 v14.15.4。
我在官方create-react-appgithubhere也发过issue了
【问题讨论】:
-
尝试全局安装
npm install -g create-react-app,然后使用create-react-app abc看看是否有效 -
感谢您的建议,但我仍然遇到同样的错误。 @TarunLalwani
-
你的节点版本是多少?
-
正如我的问题中提到的,我正在使用
node v14.15.4.@TarunLalwani -
我无法使用
node v14.15.4和npx create-react-app abc重现此问题。我建议你卸载 node.js 并重新安装并重试。
标签: node.js reactjs windows create-react-app