导航

安装Node和NPM

 

1.node和NPM是什么?

 

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

 

Node是基于V8的js runtime.

Node.js的特点:

  • 事件驱动
  • 非阻塞IO

Node.js的包管理工具:NPM(node package manager),类比python,ruby的包管理工具。

 

2.安装

2.1 Mac OSX 上安装

使用brew来安装就可以了

brew install node

2.2 Winows上安装node

参考:http://www.tuicool.com/articles/UJNb2eJ

http://imweb.io/topic/57289aa78a0819f17b7d9d5e?utm_source=tuicool&utm_medium=referral

image

 

NPM的一些设置

使用npm list 来查看npm的一些设置,可以看到对某个设置项,有set,get,edit,delete方法。

image

 

或者是直接编辑用户主目录下的 .npmrc 文件:

c:/users/XX/.npmrc

image

 

修改源为淘宝的镜像源:

http://cnodejs.org/topic/4f9904f9407edba21468f31e

1.通过config命令

npm config set registry https://registry.npm.taobao.org 
npm info underscore (如果上面配置正确这个命令会有字符串response)

2.命令行指定

npm --registry https://registry.npm.taobao.org info underscore 

3.编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org

搜索镜像: https://npm.taobao.org

建立或使用镜像,参考: https://github.com/cnpm/cnpmjs.org

下面是在mac的上NPM设置项列表

image

posted on 2016-05-29 00:06  淅沥枫  阅读(2347)  评论(0编辑  收藏  举报