2016-07-27 97 views
0

運行npm shrinkwrap後的路徑,我覺得我們必須爲localhost多次提到:NPM拆封包含本地主機

egrep localhost npm-shrinkwrap.json 
    "resolved": "http://localhost:4873/constants-browserify/-/constants-browserify-0.0.1.tgz" 
    "resolved": "http://localhost:4873/https-browserify/-/https-browserify-0.0.0.tgz" 
    "resolved": "http://localhost:4873/path-browserify/-/path-browserify-0.0.0.tgz" 
    "resolved": "http://localhost:4873/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz" 
    "resolved": "http://localhost:4873/ripemd160/-/ripemd160-0.2.0.tgz" 
    "resolved": "http://localhost:4873/sha.js/-/sha.js-2.2.6.tgz" 
    "resolved": "http://localhost:4873/shimmer/-/shimmer-1.1.0.tgz" 
    "resolved": "http://localhost:4873/tty-browserify/-/tty-browserify-0.0.0.tgz" 
    "resolved": "http://localhost:4873/utils-merge/-/utils-merge-1.0.0.tgz" 
    "resolved": "http://localhost:4873/vm-browserify/-/vm-browserify-0.0.4.tgz" 

原來這些文獻也都在原node_modules:

egrep 'localhost:4873' node_modules/ -r 
node_modules/path-browserify/package.json: "_resolved": "http://localhost:4873/path-browserify/-/path-browserify-0.0.0.tgz", 
node_modules/utils-merge/package.json: "_resolved": "http://localhost:4873/utils-merge/-/utils-merge-1.0.0.tgz", 
node_modules/ripemd160/package.json: "_resolved": "http://localhost:4873/ripemd160/-/ripemd160-0.2.0.tgz", 
node_modules/constants-browserify/package.json: "_resolved": "http://localhost:4873/constants-browserify/-/constants-browserify-0.0.1.tgz", 
node_modules/tty-browserify/package.json: "_resolved": "http://localhost:4873/tty-browserify/-/tty-browserify-0.0.0.tgz", 
node_modules/vm-browserify/package.json: "_resolved": "http://localhost:4873/vm-browserify/-/vm-browserify-0.0.4.tgz", 
node_modules/shimmer/package.json: "_resolved": "http://localhost:4873/shimmer/-/shimmer-1.1.0.tgz", 
node_modules/https-browserify/package.json: "_resolved": "http://localhost:4873/https-browserify/-/https-browserify-0.0.0.tgz", 
node_modules/pbkdf2-compat/package.json: "_resolved": "http://localhost:4873/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz", 
node_modules/sha.js/package.json: "_resolved": "http://localhost:4873/sha.js/-/sha.js-2.2.6.tgz", 

因此,這意味着當我們安裝時,我收到很多讀取和重試錯誤:

npm ERR! fetch failed http://localhost:4873/constants-browserify/-/constants-browserify-0.0.1.tgz 
npm WARN retry will retry, error on last attempt: Error: connect ECONNREFUSED 127.0.0.1:4873 
npm ERR! fetch failed http://localhost:4873/https-browserify/-/https-browserify-0.0.0.tgz 
npm WARN retry will retry, error on last attempt: Error: connect ECONNREFUSED 127.0.0.1:4873 
... 

This c沒錯。解決這個問題的最好方法是什麼?

+0

您是否正在運行本地npm服務器? – SLaks

+0

看起來像你正在運行https://www.npmjs.com/package/sinopia – SLaks

+0

沒有本地服務器...此外'npm獲取註冊表'返回'https:// registry.npmjs.org /'所以不是指向本地主機... – jcalfee314

回答

0

我有類似的問題。我經常在註冊管理機構之間切換。解決方案是在安裝/收縮包裝之前運行npm cache clear