node.js 的錯誤提示

來源:互聯網
上載者:User

標籤:style   http   color   os   io   ar   div   linux   

npm ERR!     at Object.parse (native)npm ERR!     at RegClient.<anonymous> (/usr/local/node/lib/node_modules/npm/node_                                                                                       modules/npm-registry-client/lib/request.js:266:23)npm ERR!     at Request._callback (/usr/local/node/lib/node_modules/npm/node_modu                                                                                       les/npm-registry-client/lib/request.js:238:65)npm ERR!     at Request.self.callback (/usr/local/node/lib/node_modules/npm/node_                                                                                       modules/request/request.js:123:22)npm ERR!     at Request.emit (events.js:98:17)npm ERR!     at Request.<anonymous> (/usr/local/node/lib/node_modules/npm/node_m                                                                                        dules/request/request.js:893:14)npm ERR!     at Request.emit (events.js:117:20)npm ERR!     at IncomingMessage.<anonymous> (/usr/local/node/lib/node_modules/np                                                                                        /node_modules/request/request.js:844:12)npm ERR!     at IncomingMessage.emit (events.js:117:20)npm ERR!     at _stream_readable.js:938:16npm ERR! If you need help, you may report this *entire* log,npm ERR! including the npm and node versions, at:npm ERR!     <http://github.com/npm/npm/issues>npm ERR! System Linux 2.6.32-358.el6.i686npm ERR! command "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install"                                                                                         -g" "express"npm ERR! cwd /root/node/my-projectnpm ERR! node -v v0.10.30npm ERR! npm -v 1.4.21npm ERR! type unexpected_eosnpm ERR!npm ERR! Additional logging details can be found in:npm ERR!     /root/node/my-project/npm-debug.lognpm ERR! not ok code 0[[email protected] my-project]# npm install -g expressnpm ERR! registry error parsing jsonnpm ERR! 404 404 Not Found: expressnpmnpm ERR! 404npm ERR! 404 ‘expressnpm‘ is not in the npm registry.npm ERR! 404 You should bug the author to publish itnpm ERR! 404npm ERR! 404 Note that you can also install from anpm ERR! 404 tarball, folder, or http url, or git url.npm ERR! System Linux 2.6.32-358.el6.i686npm ERR! command "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install" "-g" "expressnpm" "ERR!" "registry" "error" "parsing" "json"npm ERR! cwd /root/node/my-projectnpm ERR! node -v v0.10.30npm ERR! npm -v 1.4.21npm ERR! code E404npm ERR!npm ERR! Additional logging details can be found in:npm ERR!     /root/node/my-project/npm-debug.lognpm ERR! not ok code 0

看後面那麼多404想必是因為網路引起,安裝出錯,於是於是去查了一下,原來npm,也像Linux的軟體一樣有自己的鏡像源,感覺不錯,雖然也存在依賴關係,非常不錯、

下面就是切換npm鏡像源的方法有三種:

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

如果還是失敗就把三個方法都做一次

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.