create-react-app安装出错

安装 create-react-app

执行命令:

npm i -g create-react-app

结果出错,错误如下:

Lenovo@Lenovo-PC MINGW64 /d/workStation/practice/react
$ npm i -g create-react-app
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-react-app failed, reason: connect
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Lenovo\AppData\Roaming\npm-cache\_logs\2020-07-28T06_33_46_042Z-debug.log

淘宝镜像换源:

//换源
npm config set registry https://registry.npm.taobao.org
//查看
npm config get registry

再次执行安装命令报错:

Lenovo@Lenovo-PC MINGW64 /d/workStation/practice/react
$ npm i -g create-react-app
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm WARN checkPermissions Missing write access to C:\Users\Lenovo\AppData\Roaming\npm\node_modul
npm ERR! path C:\Users\Lenovo\AppData\Roaming\npm\node_modules\create-react-app\node_modules\os-
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'C:\Users\Lenovo\AppData\Roaming\npm\n
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Lenovo\AppData\Roaming\npm-cache\_logs\2020-07-28T06_40_00_579Z-debug.log

这时候我去到 C:\Users\Lenovo\AppData\Roaming\npm\node_modules 文件夹,把create-react-app 文件夹删除后,再重新执行全局安装命令,就安装成功了。
在这里插入图片描述

遇到问题记录一下,如有不严谨的地方,还请不吝赐教。

猜你喜欢

转载自blog.csdn.net/qq_39352780/article/details/107636846