执行完npx create-react-app my-app报错了

执行完npx create-react-app my-app报错了


C:\Users\Administrator\Desktop>npx create-react-app my-app

npx: installed 91 in 43.744s


Creating a new React app in C:\Users\Administrator\Desktop\my-app.


Installing packages. This might take a couple of minutes.

Installing react, react-dom, and react-scripts...


npm ERR! code Z_BUF_ERROR

npm ERR! errno -5

npm ERR! zlib: unexpected end of file


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-09-25T0

8_16_37_577Z-debug.log


Aborting installation.

  npm install --save --save-exact --loglevel error react react-dom react-scripts

 has failed.


Deleting generated file... package.json

Deleting my-app/ from C:\Users\Administrator\Desktop

Done.


C:\Users\Administrator\Desktop>


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕星星 2019-09-25 17:15:08

同学你好,

可能是因为npx下载国外的资源获取不到,可以用镜像试试:

npm config set registry https://registry.npm.taobao.or

检测镜像是否安装成功:

npm config get registry

然后下载模板:

create-react-app my-app

自己试一下,祝学习愉快!

  • 提问者 慕尼黑5444710 #1
    执行完上面的命令之后又报下面的错误: Creating a new React app in C:\Users\Administrator\Desktop\my-app. Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts... npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npm.taobao.or/react failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.or registry.npm.taobao.or:443 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\Administrator\AppData\Roaming\npm-cache\_logs\2019-09-25T09_35_18_849Z-debug.log Aborting installation. npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. Deleting generated file... package.json Deleting my-app/ from C:\Users\Administrator\Desktop Done. Administrator@PC-201803271754 MINGW64 ~/Desktop
    2019-09-25 17:39:18
  • 提问者 慕尼黑5444710 #2
    解决了谢谢老师
    2019-09-25 17:58:44
  • 好帮手慕星星 回复 提问者 慕尼黑5444710 #3
    解决了问题就是好的哦,继续加油~
    2019-09-25 18:06:21
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师