1、使用淘宝
C:\Windows>npm config get registry
https://registry.npmjs.org/
npm config set registry=https://registry.npm.taobao.org
--cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
-- 验证全部config
C:\Windows>npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/4.6.1 node/v12.13.0 win32 x64"
; userconfig C:\Users\Administrator\.npmrc
python = "C:\\Python3\\python.exe"
; builtin config undefined
prefix = "C:\\Users\\Administrator\\AppData\\Roaming\\npm"
; node bin location = D:\program\nodejs\node.exe
; cwd = C:\Windows
; HOME = C:\Users\Administrator
; "npm config ls -l" to show all defaults.
2、查看安装路径
C:\Windows>npm root
C:\Windows\node_modules
3、配置信息
npm config list
npm config delete python
npm config set $key=$value
4、更新、卸载
npm uninstall gulp --save-dev
--save-dev 开发阶段;卸载开发阶段使用的模块 gulp
npm update [-g] [pkg]
5、在项目中创建package.json
npm init
6、管理模块缓存
npm cache ls [<path>]
npm cache clean
7、view查看模块
查看模块的依赖关系
npm view gulp dependencies
查看模块的源文件地址
npm view gulp repository.url
查看模块的贡献者,包含邮箱地址
npm view npm contributors
8、package.json
欢乐木匠艾瑞克翻译
package.json










网友评论