跳到主要内容

命令

2023年05月26日
柏拉文
越努力,越幸运

一、初始化


npm init -y: 默认初始化

二、安装包


// 安装最新版本
npm install xxx

// 安装指定版本
npm install xxx@版本号

四、删除包


// 删除指定模块
npm uninstall xxx
// 删除指定模块(简写)
npm uni xxx

// 删除全局模块
npm uninstall -g xxx

三、更新包


四、查看包


npm list -g --depth 0

五、软链接


  1. 为依赖包建立全局软链接(在依赖包根目录)
npm link 
  1. 项目使用该依赖包全局软链(在项目根目录)
npm link 链接包名称

六、清除缓存


npm cache clean --force

七、运行命令


npm run <cmd>: 运行命令