- 1. 版本号
- 2 npm i和npm install
- cnpm 使用">3 cnpm 使用
- npm script">4 npm script
- 5 pnpm
- 6 yarn
- 6.1 切换到国内cnpm源
- yarn link 调试开发阶段的包">6.2 yarn link 调试开发阶段的包
- nrm - npm register manager">7 nrm - npm register manager
1. 版本号
2 npm i和npm install
3 cnpm 使用
cnpm 不会lock版本,以及在node_moudule下生成_xxx包名,
要是想利用淘宝源,建议 npm install xxxx —registry=https://registry.npm.taobao.org
1.临时使用
npm —registry https://registry.npm.taobao.org install express
2.持久使用
npm config set registry https://registry.npm.taobao.org
3.通过cnpm
npm install -g cnpm —registry=https://registry.npm.taobao.org
4使用官方镜像
npm config set registry https://registry.npmjs.org/
5 查看npm源地址
4 npm script
同时参考本库linux-shell 和 linux-bash
5 pnpm
https://www.pnpm.cn/
节省磁盘空间并提升安装速度 | 创建非扁平的 node_modules 目录
6 yarn
6.1 切换到国内cnpm源
查看
yarn config get registry
切换
yarn config set registry https://registry.npmmirror.com
6.2 yarn link 调试开发阶段的包
参考: react源码调试
7 nrm - npm register manager
nrm can help you easy and fast switch between different npm registries, now include: npm, cnpm, taobao, nj(nodejitsu).以及私有仓库
$ nrm ls
$ nrm use cnpm
//switch registry to cnpm Registry has been set to: http://r.cnpmjs.org/
nrm add sinopia http://ip:4873
nrm use sinopia
npm install some-private-npm