睁眼写BUG,闭眼改BUG。

npm 简单使用

2020.03.02

很好用的一个工具,特别是前端.

fighting!fighting!

...

npm

安装&更新

  • 下载 node.js
  • 运行cmd查看
npm -v //查看版本
npm install npm@latest -g //更新至最新的稳定版
Ctrl+C //强制打断

常用操作

intellij idea 中 alt + f12 调出命令行

npm init -y  //初始化
npm install jquery //下载jquery install==i
npm i //会把之前环境全部配置
npm unistall xxx // 卸载某玩意
npm update xxx // 更新某玩意
npm i xxx@版本号 //下载某玩意的某版本

常用配置

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    "yo": "echo \"Yo.\""
  },
npm run test  // 运行自定义的命令
npm run yo

常用命令

在npm中,包(package)、模块(module)、依赖(dependency)说的都是一回事儿。