diff --git a/docs/npm.html b/docs/npm.html index 997e426e..a0f9bf2a 100644 --- a/docs/npm.html +++ b/docs/npm.html @@ -5,7 +5,7 @@
这个 npm 快速参考备忘单显示了它的常用命令使用清单。
+这个 npm 快速参考备忘单显示了它的常用命令使用清单
用于添加、列出或清理 npm 缓存文件夹
+用于添加、列出或清理 npm 缓存文件夹
命令 | 描述 |
---|---|
npm version <version> | 要更改 package.json 中的版本号 |
npm update | 更新生产包 |
npm update --dev | 更新开发包 |
npm update -g | 更新全局包 |
npm update lodash | 更新 lodash 包 |
命令 | 描述 |
---|---|
npm version <version> | 要更改 package.json 中的版本号 |
npm update | 更新生产包 |
npm update --dev | 更新开发包 |
npm update -g | 更新全局包 |
npm update lodash | 更新 lodash 包 |
将某人添加为所有者
-npm owner add USERNAME PACKAGENAME
+# 将某人添加为所有者
+npm owner add USERNAME PACKAGENAME
+# 列出包
+npm ls
+# 向安装旧版本软件包的用户添加警告(弃用)
+npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
+# 更新所有包或选定的包
+npm update [-g] PACKAGE
+# 检查过时的包
+npm outdated [PACKAGE]
-列出包
-npm ls
-
-向安装旧版本软件包的用户添加警告(弃用)
-npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
-
-更新所有包或选定的包
-npm update [-g] PACKAGE
-
-检查过时的包
-npm outdated [PACKAGE]
+
npm unpublish <package-name> -f
+# 取消指定版本
+npm unpublish <package-name>@<version>
+注意:如果您取消发布整个包,则必须在 24 小时后才能发布该包的任何新版本
将公共包设为私有
-npm access restricted <package-name>
-
-公开私有包
-npm access public <package-name>
-
-授予私有包访问权限
-npm owner add <user> <your-package-name>
+# 将公共包设为私有
+$ npm access restricted <package-name>
+# 公开私有包
+$ npm access public <package-name>
+# 授予私有包访问权限
+$ npm owner add <user> <your-package-name>
npm owner add <their-username> <package-name>
@@ -270,18 +270,17 @@
写入启用了双因素身份验证
npm owner add <their-username> <package-name> --otp=123456
-
npm unpublish <package-name> -f
-# 取消指定版本
-npm unpublish <package-name>@<version>
-
-注意:如果您取消发布整个包,则必须在 24 小时后才能发布该包的任何新版本。
$ npm install -g nrm # 安装 nrm 包
+$ nrm ls # 查看 registry 列表
+$ nrm use cnpm # 将注册表切换到 cnpm
+
:- | :- |
---|---|
/path/to/project/.npmrc | 每个项目的配置文件 |
~/.npmrc | 每个用户的配置文件 |
$PREFIX/etc/npmrc | 全局配置文件 |
/path/to/npm/npmrc | npm 内置配置文件 |
# last modified: 01 Jan 2016
+
.npmignore
将下面内容存放到 .npmignore
文件中,放置在项目的根目录中。
.git
@@ -334,7 +368,7 @@
# 临时使用
$ npm install -g <package-name> --registry=https://registry.npmmirror.com
-将配置放置在 .npmrc
全局配置文件中,或者在项目的根目录中。
+将配置放置在 .npmrc
全局配置文件中,或者在项目的根目录中。
; registry=https://registry.npmjs.org/
registry=https://registry.npmmirror.com
@@ -344,7 +378,7 @@
}
替换 npm 仓库地址为 npmmirror(淘宝) 镜像地址
-npm config set registry https://registry.npmmirror.com
+$ npm config set registry https://registry.npmmirror.com
请参阅:npmmirror 中国镜像站
electronjs 镜像和缓存