npm 常用命令 常用知识

发布时间 2023-08-25 13:57:08作者: PrintY

1、常用命令

参考:

https://www.cnblogs.com/BJQE/p/16510627.html

https://zhuanlan.zhihu.com/p/442407879

1、清除缓存

有时候安装或卸载模块时,出现错误,有可能是缓存未清理的缘故。

npm cache clean --force

2、知识点

2.1 npm i和npm install的区别

实际使用的区别点主要如下(windows下):
1. 用npm i安装的模块无法用npm uninstall删除,用npm uninstall i才卸载掉
2. npm i会帮助检测与当前node版本最匹配的npm包版本号,并匹配出来相互依赖的npm包应该提升的版本号
3. 部分npm包在当前node版本下无法使用,必须使用建议版本
4. 安装报错时intall肯定会出现npm-debug.log 文件,npm i不一定

转自:https://blog.csdn.net/chern1992/article/details/79193211