Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM国内镜像配置和CNPM使用 #4

Open
zhaoda opened this issue Apr 13, 2014 · 0 comments
Open

NPM国内镜像配置和CNPM使用 #4

zhaoda opened this issue Apr 13, 2014 · 0 comments
Labels

Comments

@zhaoda
Copy link
Owner

zhaoda commented Apr 13, 2014

NPM镜像配置

  1. 通过 config 配置
$ npm config set registry http://r.cnpmjs.org
  1. 命令行临时指定
$ npm --registry http://r.cnpmjs.org install koa
  1. 编辑 ~/.npmrc
registry = http://r.cnpmjs.org
  1. 其他npm配置
$ npm config set strict-ssl false # 关闭npm的https
$ npm config set proxy=http://ip:port # 设置npm获取的代理服务器地址
$ npm config delete http-proxy # 清除npm的http代理
$ npm config delete https-proxy # 清除npm的https代理
$ npm install -g koa --proxy http://ip:port # 临时使用代理

CNPM——node包管理器

安装

$ npm install -g cnpm --registry=http://r.cnpmjs.org

或者

$ alias cnpm="npm --registry=http://r.cnpmjs.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=http://cnpmjs.org/dist \
--userconfig=$HOME/.cnpmrc"

#或者把该设置放到shell配置文件里 .bashrc or .zshrc
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=http://r.cnpmjs.org \
  --cache=$HOME/.npm/.cache/cnpm \
  --disturl=http://cnpmjs.org/dist \
  --userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc

使用

$ cnpm install [name] # 安装
$ cnpm sync connect # 同步
$ open http://cnpmjs.org/sync/connect # 通过web浏览器查看

$ cnpm publish [name]
$ cnpm unpublish [name]

$ cnpm info cnpm
@zhaoda zhaoda added the Node.js label Apr 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant