nodeJS安裝及npm設置淘寶鏡像

nodeJS安裝及npm設置淘寶鏡像

node

  •     node.js安裝
  •     下載node.js安裝包:https://nodejs.org/en/download/,下載相應版本的node.js.
  •     需注意,在window中,node的安裝目錄中,最好不要有空格或中文字符。
  •     nodeJS的資源倉庫在國內使用過程當中,偶爾會遇到各類資源問題,一般設置爲淘寶的鏡像,網上不少說法是安裝淘寶鏡像,即
    $ npm install -g cnpm --registry=https://registry.npm.taobao.org
    而後再用到npm install的時候,使用cnpm install進行安裝node_modules。
    可是該種方式,在集成到IED的時候,你如在IDEA中,若是想在IDEA中,直接使用node的命令,進行install,就行不通了。
    這個時候,能夠使用第二種方式:
    npm config set registry " https://registry.npm.taobao.org "
    更改npm的config的registry 爲淘寶鏡像,而後再使用npm的時候,就是從淘寶鏡像拉取數據了。

    在更新node-sass中,有時候也會出現資源下載不了的問題,一般是git上的資源下載不了,這時候,能夠更改node-sass的資源路徑爲淘寶的
    npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
    phantomjs的源
    npm config set phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
    electron源
    npm config set electron_mirror=https://npm.taobao.org/mirrors/electron/
相關文章
相關標籤/搜索