针对cnpm在安装npm包时出现的各种版本问题
规范运行/部署的命令如下:
之前通过cnpm安装过的 node_modules,请先行删除
1、修改npm源,解决npm安装慢的问题(已修改可忽略)
npm config set registry https://registry.npm.taobao.org
1.1、恢复官方源(若修改国内镜像源后无法安装可尝试恢复源)
npm config set registry https://registry.npmjs.org
2、安装包
npm install
若安装失败可尝试删除node_modules后再重新执行此命令
3、运行/打包
本地:npm run dev
扩展
yarn
安装
npm install yarn -g
更换源
yarn config set registry https://registry.npm.taobao.org/
恢复官方源
yarn config set registry https://registry.yarnpkg.com
安装项目所有依赖
yarn 或者 yarn install