分类 | 命令 | 介绍 |
npm -v | 查看版本 | |
npm install npm -g | 升级 | |
npm install -g cnpm --registry=https://registry.npm.taobao.org | 使用淘宝镜像命令 | |
模块安装 | npm install <Module Name> | npm 命令安装模块 |
npm install express | # 本地安装 | |
npm install express -g | # 全局安装 | |
npm list -g | 查看安装信息 | |
npm list grunt | 查看某个模块的版本号 | |
模块更新
| npm uninstall express | 卸载模块 |
npm update express | 更新模块 | |
npm search express | 搜索模块 | |
npm init | 卸载模块 | |
模块创建 | npm ls | 创建模块 |
npm adduser Username: mcmohd Password: Email: (this IS public) mcmohd@gmail.com | 注册用户 | |
npm publish | 发布 | |
react | cnpm install -g create-react-app | |
create-react-app my-app | ||
npm start | ||
webpack | npm init -y | 默认初始化package.jion |
npm install webpack webpack-cli --save-dev | 本地安装-webpack | |
npm install webpack-cli -g | ||
npm install --save lodash | 如果安装webpack-cli失败可以尝试安装全局版本 | |
webpack demo.js -o demo.bundle.js | 简单的打包命令 | |
npx webpack | 会将我们的脚本作为入口起点,然后 输出 为 main.js | |
fetch
| cnpm install whatwg-fetch --save | 安装 |
cnpm install es6-promise --save | 为了兼容老版本浏览器 | |
Ant Design | npm install antd --save | |
redux | npm install --save redux | |
npm install --save react-redux | ||
npm install --save-dev redux-devtools | ||