企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
## 淘宝 NPM 镜像 ### 使用说明 #### 方法一:你可以使用我们定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm: ~~~ $ npm install -g cnpm --registry=https://registry.npm.taobao.org ~~~ 或者你直接通过添加 npm 参数 alias 一个新命令: ~~~ alias cnpm="npm --registry=https://registry.npm.taobao.org \ --cache=$HOME/.npm/.cache/cnpm \ --disturl=https://npm.taobao.org/dist \ --userconfig=$HOME/.cnpmrc" # Or alias it in .bashrc or .zshrc $ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \ --cache=$HOME/.npm/.cache/cnpm \ --disturl=https://npm.taobao.org/dist \ --userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc ~~~ #### 方法二: 安装 ~~~ npm install -g nrm ~~~ 查看可用源: ~~~ nrm ls * npm ----- https://registry.npmjs.org/ cnpm ---- http://r.cnpmjs.org/ taobao -- https://registry.npm.taobao.org/ nj ------ https://registry.nodejitsu.com/ rednpm -- http://registry.mirror.cqupt.edu.cn skimdb -- https://skimdb.npmjs.com/registry ~~~ 切换源 ~~~ nrm use taobao ~~~ ### 安装模块 从 registry.npm.taobao.org 安装所有模块. 当安装的时候发现安装的模块还没有同步过来, 淘宝 NPM 会自动在后台进行同步, 并且会让你从官方 NPM registry.npmjs.org 进行安装. 下次你再安装这个模块的时候, 就会直接从 淘宝 NPM 安装了. ~~~ $ cnpm install [name] ~~~ ### 同步模块 直接通过 sync 命令马上同步一个模块, 只有 cnpm 命令行才有此功能: ~~~ $ cnpm sync connect ~~~ 当然, 你可以直接通过 web 方式来同步: /sync/connect ~~~ $ open https://npm.taobao.org/sync/connect ~~~ ### 其它命令 支持 npm 除了 publish 之外的所有命令, 如: ~~~ $ cnpm info connect ~~~