npm常用命令

  • npm config edit 直接打开编辑

  • npm config list 查看相关信息

  • npm config get cache 缓存位置

  • npm config get prefix 全局安装的位置

  • npm config set prefix "<new_path>" 修改全局文件安装的位置

  • npm config set cache "<new_path>" 修改缓存文件的位置

  • npm config get registry 查看是什么源

  • npm install --registry=https://registry.npm.taobao.org 暂时换淘宝源

  • npm config set registry http://registry.npm.taobao.org 换淘宝源

  • npm config set registry https://registry.npmjs.org/ 换回npm源

  • npm install --save 保存在package.json中dependencies字段下,安装生产环境依赖的模块

  • npm install --save-dev 保存在package.json中devDependencies字段下,安装开发环境依赖的模块

  • npm install -g npm @latest 更新npm

  • npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass 更换node_sass源

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容