1. 程式人生 > >NodeJs安裝與配置淘寶映象

NodeJs安裝與配置淘寶映象

1. 安裝:

2. 配置

2.1 檢視安裝結果與版本

    node -v #檢視安裝版本
    npm -v #檢視npm安裝版本

2.2 使用國內的淘寶映象

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

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 #檢視配置項