create-react-app创建react时报错,主要原因是npm install失败,解决这个问题的方法网上有很多种,罗列一下:
- 升级npm版本:
npm install -g npm
(有不少人反应这个方法无效) - npm清缓存:
npm cache verify
npm cache clean
npm cache clean --force
3.npm更换镜像源:
npm install -g cnpm --registry=https://registry.npm.taobao.org
4.使用cnpm:
npm install -g cnpm -registry=https://registry.npm.taobao.org
我个人使用的是第四种方法,亲测有效