【问题标题】:unable to install anything using npm command无法使用 npm 命令安装任何东西
【发布时间】:2015-12-05 02:10:31
【问题描述】:
node version :- v4.2.1
npm version :- 2.14.7
npm config get proxy: - null
npm config get https-proxy :- null

无法在 mac el capitan 上安装 bower、ionic、cordova 等任何东西,它只是说:

npm WARN Building the local index for the first time, please be patient
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "search"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo

npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR! /Users/shashank/npm-debug.log

debug.log :- 
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'bower' ]
2 info using npm@2.14.7
3 info using node@v4.2.1
4 verbose config Skipping project config: /Users/shashank/.npmrc. (matches userconfig)
5 verbose install initial load of /Users/shashank/package.json
6 verbose readDependencies loading dependencies from /Users/shashank/package.json
7 silly cache add args [ 'bower', null ]
8 verbose cache add spec bower
9 silly cache add parsed spec Result {
9 silly cache add raw: 'bower',
9 silly cache add scope: null,
9 silly cache add name: 'bower',
9 silly cache add rawSpec: '',
9 silly cache add spec: '',
9 silly cache add type: 'range' }
10 silly addNamed bower@
11 verbose addNamed "" is a valid semver range for bower
12 silly addNameRange { name: 'bower', range: '', hasData: false }
13 silly mapToRegistry name bower
14 silly mapToRegistry using default registry
15 silly mapToRegistry registry http: //registry.npmjs.org/
16 silly mapToRegistry uri http: //registry.npmjs.org/bower
17 verbose addNameRange registry:http:  //registry.npmjs.org/bower not in flight; fetching
18 verbose request uri http: //"registry.npmjs.org/bower"
19 verbose request no auth needed
20 info attempt registry request try #1 at 10:37:36 AM
21 verbose request id 0385537c58e562b4
22 http request GET http: //registry.npmjs.org/bower
23 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
24 info attempt registry request try #2 at 10:37:49 AM
25 http request GET http: //registry.npmjs.org/bower
26 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
27 info attempt registry request try #3 at 10:38:52 AM
28 http request GET http: //registry.npmjs.org/bower
29 verbose stack Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
29 verbose stack at errnoException (dns.js:26:10)
29 verbose stack at GetAddrInfoReqWrap.onlookup as oncomplete
30 verbose cwd /Users/shashank
31 error Darwin 15.0.0
32 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "bower"
33 error node v4.2.1
34 error npm v2.14.7
35 error code ENOTFOUND
36 error errno ENOTFOUND
37 error syscall getaddrinfo
38 error network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
38 error network This is most likely not a problem with npm itself
38 error network and is related to network connectivity.
38 error network In most cases you are behind a proxy or have bad network settings.
38 error network
38 error network If you are behind a proxy, please make sure that the
"~/npm-debug.log" [readonly] 57L, 2836C

【问题讨论】:

  • 您确定在尝试安装时已连接到网络?您是否也尝试过使用 sudo 的 npm 命令?
  • 也检查这个问题 - 你可能会发现一些提示stackoverflow.com/questions/23193614/…
  • 是的,我也尝试过 sudo 但没有运气
  • 您的错误日志有提示,我之前的评论有指向相关答案的链接。 “这很可能不是 npm 本身 38 错误网络的问题,并且与网络连接有关。38 错误网络在大多数情况下,您在代理后面或网络设置错误”
  • 我已经禁用了 mac 网络设置中的所有代理,甚至在 lan 和 wifi 网络上都尝试过,但得到相同的错误

标签: npm


【解决方案1】:

请在您的路由器中禁用防火墙。从路由器设置中禁用路由器防火墙后,我遇到了类似的问题。

【讨论】:

    猜你喜欢
    • 2019-11-21
    • 1970-01-01
    • 2017-03-30
    • 2019-07-19
    • 2020-07-31
    • 1970-01-01
    • 2020-11-05
    • 2021-05-02
    • 2014-06-08
    相关资源
    最近更新 更多