[英]when I try to create a react app it gives an error
first thing I run this command to install the create-react-app
我首先运行此命令来安装
create-react-app
npm install -g create-react-app
when It finishes everything and then I run the create-react-app name
command it gives a weird error 当它完成所有内容然后我运行
create-react-app name
命令时会出现一个奇怪的错误
C:\Users\Mostafa Ossama\Desktop>create-react-app swag-shop-web
Creating a new React app in C:\Users\Mostafa Ossama\Desktop\swag-shop-web.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
events.js:137
throw er; // Unhandled 'error' event
^
Error: spawn C:\Users\Mostafa Ossama\AppData\Roaming\npm\node_modules\create-react-app ENOENT
at _errnoException (util.js:1003:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
at onErrorNT (internal/child_process.js:389:16)
at process._tickCallback (internal/process/next_tick.js:152:19)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:190:16)
at bootstrap_node.js:662:3
is It a problem in the PATH ??(maybe but I don't think so because I run nodemon normally) 它是PATH中的一个问题吗?(也许但我不这么认为,因为我正常运行nodemon )
I tried to uninstall and install create-react-app again , but I had the same problem. 我试图再次卸载并安装create-react-app ,但我遇到了同样的问题。
Thanks in advance to everyone.. 在此先感谢大家..
I'm using windows 10 pro 64-bit version: 1709 我正在使用Windows 10专业版64位版本:1709
node version: v9.5.0 节点版本:v9.5.0
npm version: 5.7.1 npm版本:5.7.1
I use both powershell and the git bash (most of the time git-bash) 我使用powershell和git bash(大部分时间都是git-bash)
powershell version: 5.1.16299.248 powershell版本:5.1.16299.248
git version: 2.15.1.windows.2 git版本:2.15.1.windows.2
{ npm: '5.7.1',
ares: '1.13.0',
cldr: '32.0',
http_parser: '2.7.0',
icu: '60.1',
modules: '59',
napi: '2',
nghttp2: '1.29.0',
node: '9.5.0',
openssl: '1.0.2n',
tz: '2017c',
unicode: '10.0',
uv: '1.19.1',
v8: '6.2.414.46-node.18',
zlib: '1.2.11' }
The same issue that I resolve myself by completely removing and reinstalling the nodejs
. 我通过完全删除并重新安装
nodejs
解决自己的nodejs
。 from logs, it looks like that it's definitely a problem with how node
is set up on your computer, and you'd need to fix that first. 从日志来看,它看起来肯定是你的计算机上如何设置
node
的问题,你需要先修复它。
I would recommend you to uninstall node
and npm
completely and reinstall it again. 我建议你完全卸载
node
和npm
然后重新安装。
Remove %PATH% environment variable
references of nodejs
and npm
if any. 删除
nodejs
和npm
%PATH% environment variable
引用(如果有)。
Uninstall node
and npm
from the Programs & Features
with the windows uninstaller. 使用Windows卸载
Programs & Features
从“ Programs & Features
卸载node
和npm
。
Reboot the system to kill all the existing and still running processes of node
and npm
after uninstallation. 重新启动系统以在卸载后
npm
所有现有且仍在运行的node
和npm
进程。
To newly install node
and npm
you can refer this documentation: http://blog.teamtreehouse.com/install-node-js-npm-windows 要新安装
node
和npm
,可以参考以下文档: http : //blog.teamtreehouse.com/install-node-js-npm-windows
I would also recommend using node
with nvm
. 我还建议使用
nvm
node
。 for same you can refer below documentation: https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47 同样你可以参考下面的文档: https : //medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47
To install your required package and work around with it easily you can refer below documentation: https://github.com/facebook/create-react-app 要安装所需的软件包并轻松使用它,您可以参考以下文档: https : //github.com/facebook/create-react-app
Hope this is helpful to you! 希望这对你有所帮助!
我联系了npm支持,但没有任何工作,我只是重新安装我的操作系统,它工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.