# npm安装错误
PS C:\Users\zxp1> npm i -g @vue/cli
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\zxp1\AppData\Roaming\npm-cache\_logs\2019-04-19T05_12_38_552Z-debug.log
PS C:\Users\zxp1> npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 解决方案:
1.npm清空缓存
npm cache clean --force
//或者
npm cache clean
1
2
3
2
3
2.npm更换下载源
npm config get registry
npm config list
1
2
2
- 设置为npm源
//设置为npm源
npm config set registry https://registry.npmjs.org
//https -> http
npm config set registry http://registry.npmjs.org
1
2
3
4
2
3
4
- 设置为淘宝npm源
//更换为淘宝源
npm config set registry https://registry.npm.taobao.org
//临时替换为淘宝源
npm --registry=https://registry.npm.taobao.org
1
2
3
4
2
3
4
# npm发布命令
# 查看类型
npm version <update_type>;
1
# 发布包
npm publish
1
# 更新
# 补丁修改
例如:从1.0.1到1.0.2
npm version patch
1
# 小问题修改
例如:从1.1.0到1.2.0
npm version minor
1
# 大改
例如:从1.0.0到2.0.0
npm version major
1
# 查看远程信息
npm view nbfirstnpmcvper
1