node包管理
- 0
#讨论区
00条评论
实时对话
loading...
bash
bash
bash
npm get registry
查看源npm --registry registry.npm.taobao.org install any-touch
临时修改npm config set registry registry.npm.taobao.org
持久使用npm config set registry registry.npmjs.org
还原npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass
设置node-sass镜像yarn config get registry
查看源yarn add any-touch@latest --registry=registry.npmjs.org/
临时修改yarn config set registry registry.npm.taobao.org/
持久修改yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass
设置node-sass镜像pnpm get registry
查看源pnpm --registry registry.npm.taobao.org install any-touch
临时修改pnpm config set registry registry.npm.taobao.org
持久使用pnpm config set registry registry.npmjs.org
还原npm | yarn | 功能 |
---|---|---|
npm install | yarn | 安装全部依赖 |
npm install react --save | yarn add react | |
npm uninstall react --save | yarn remove react | 移除依赖 |
npm install react --save-dev | yarn add react --dev | |
npm update --save | yarn upgrade | |
npm install react --global | yarn global add react | |
npm list -g --depth 0 | yarn global list --depth=0 | 查看全局安装的包 |
bash
bash
bash
这三个字段在我们的业务项目中是没有什么区别的,主要区别是在开发npm包时候和node应用
项目依赖,比如
react
开发依赖,比如
eslint
peerDependencies 主要用于依赖包中,表示安装该包时还需要安装哪些包
主要步骤如下
npm install -g npm
npm list -g --depth=0
npm install -g yarn
yarn global upgrade yarn
yarn add react
yarn add react -D
yarn global add react
npm install -g pnpm
npm config get prefix
npm config set prefix "/usr/local/Cellar/node@12/12.21.0_1"
npm config set proxy http://127.0.0.1:6152
npm config set https-proxy http://127.0.0.1:6152
yarn config set proxy http://127.0.0.1:6152
yarn confit set https-proxy http://127.0.0.1:6152
npm config delete proxy
npm config delete https-proxy
yarn config delete proxy
yarn config delete https-proxy
#yarn更新依赖
yarn upgrade-interactive --lates
#更新所有依赖
npm update
#执行以下命令不应有输出
npm outdated