npx create-react-app my-app 安装报错

问题简述

 根据react文档上安装命令行npx create-react-app my-app,但是出现报错信息。信息如下

dell@dell-PC MINGW64 /e/demo
$ npx create-react-app my-app
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_cache\_npx\17244" as it doesnot contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2018-10-24T06_13_21_695Z-debug.log
安装 prefix@latest 失败,错误代码:1
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_cache\_npx\15084" as it doesnot contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2018-10-24T06_13_23_624Z-debug.log
安装 create-react-app@latest 失败,错误代码:1

解决方法
  • 改成全局安装即可
npm install -g create-react-app 
create-react-app myApp

猜你喜欢

转载自blog.csdn.net/qq_29088015/article/details/83343734