NodeJs安装与配置淘宝镜像

1. 安装:

https://nodejs.org/en/,一般下载安装最新稳定版本

2. 配置

2.1 查看安装结果与版本

    node -v #查看安装版本
    npm -v #查看npm安装版本


2.2 使用国内的淘宝镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org
  • 1

2.3 查看Nodejs默认配置

#npm config ls -l
; cli configs
long = true
user-agent = "npm/2.14.12 node/v4.2.4 win32 x64"

; builtin config undefined
prefix = "C:\\Users\\zgr\\AppData\\Roaming\\npm"
registry = "https://registry.npm.taobao.org/"

; default values
access = null
always-auth = false
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\zgr\\AppData\\Roaming\\npm-cache"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
color = true
depth = null
description = true
dev = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
global = false
globalconfig = "C:\\Users\\zgr\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\zgr\\AppData\\Roaming\\npm\\etc\\npmignore"
group = 0
heading = "npm"
https-proxy = null
if-present = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\zgr\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
link = false
local-address = undefined
loglevel = "warn"
; long = false (overridden)
message = "%s"
node-version = "4.2.4"
npat = false
onload-script = null
optional = true
parseable = false
; prefix = "C:\\Program Files\\nodejs" (overridden)
production = false
proprietary-attribs = true
proxy = null
rebuild-bundle = true
; registry = "https://registry.npmjs.org/" (overridden)
rollback = true
save = false
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
scope = ""
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "C:\\Windows\\system32\\cmd.exe"
shrinkwrap = true
sign-git-tag = false
spin = true
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
tmp = "C:\\Users\\zgr\\AppData\\Local\\Temp"
umask = 0
unicode = true
unsafe-perm = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overri
dden)
userconfig = "C:\\Users\\zgr\\.npmrc"
version = false
versions = false
viewer = "browser"

####2.4 设置全局安装目录
npm config set cache "D:\nodejs\node_cache"
npm config set prefix "D:\nodejs\node_global"

然后就可以愉快的使用cnpm安装工具了

3 常用命令集合

node -v #查看安装版本
npm -v #查看npm安装版本

npm config ls -l #查看配置项