react创建项目命令

react创建项目命令
点击领取淘宝京东拼多多唯品会优惠券
npm install -g create-react-app
creat-react-app my-app
默认库:
https://registry.npmjs.org/

npm config set registry https://registry.npm.taobao.org -- 配置后可通过下面方式来验证是否成功 npm config get registry -- 显示出上述地址的话就是更换成功

npm config set registry https://registry.npmmirror.com/ ---阿里镜像源
npm config set registry https://npm.tuna.tsinghua.edu.cn----清华镜像源
-- 配置后可通过下面方式来验证是否成功 npm config get registry -- 显示出上述地址的话就是更换成功 npm config set proxy http://<proxy-server>:<port> npm config set https-proxy http://<proxy-server>:<port>

清理npm缓存

有时候,清理npm的缓存可以解决一些奇怪的连接问题:

npm cache clean --force

报错:
network This is a problem related to network connectivity

解决方案:
①进行代理设置为false,如下命令

npm config set proxy false

②npm缓存清理,如下命令

npm cache verify

③再次执行npm install命令即可解决此问题

报错:

npm ERR! the command again as root/Administrator.

在系统里搜索cmd然后选择以管理员身份运行即可