【发布时间】:2014-01-20 22:35:30
【问题描述】:
这是错误,不会让我安装任何东西:
npm WARN 无效配置 https-proxy="http:" npm WARN 无效配置必须是带有'http://'的完整网址
我尝试了很多事情: 卸载/安装节点和 npm
- 清理 npm 缓存
- npm config 删除 https-proxy
- 将 npm ssl 设置为 false
- npm 配置集注册表http://registry.npmjs.org/
- 试图用 npm config set https-proxy http://proxy.company.com:8080 覆盖它
- 手动打开和更改 npmrc 全局和本地文件
- 我在控制台中对 registry.npmjs.org 和 google.es 执行 ping 操作得到响应。
即使我卸载所有节点并进行新的编译,错误仍然存在。
npm 配置获取 https-proxy 和 npm config 获取 http-proxy
两个都返回 null。
我的 /home/usertv/npm-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 '-g',
1 verbose cli 'cordova' ]
2 info using npm@1.3.21
3 info using node@v0.10.24
4 warn invalid config https-proxy="http:"
5 warn invalid config Must be a full url with 'http://'
6 verbose cache add [ 'cordova', null ]
7 verbose cache add name=undefined spec="cordova" args=["cordova",null]
8 verbose parsed url { protocol: null,
8 verbose parsed url slashes: null,
8 verbose parsed url auth: null,
8 verbose parsed url host: null,
8 verbose parsed url port: null,
8 verbose parsed url hostname: null,
8 verbose parsed url hash: null,
8 verbose parsed url search: null,
8 verbose parsed url query: null,
8 verbose parsed url pathname: 'cordova',
8 verbose parsed url path: 'cordova',
8 verbose parsed url href: 'cordova' }
9 silly lockFile a98f2055-cordova cordova
10 verbose lock cordova /root/.npm/a98f2055-cordova.lock
11 silly lockFile a98f2055-cordova cordova
12 silly lockFile a98f2055-cordova cordova
13 verbose addNamed [ 'cordova', '' ]
14 verbose addNamed [ null, '*' ]
15 silly lockFile de8d9fad-cordova cordova@
16 verbose lock cordova@ /root/.npm/de8d9fad-cordova.lock
17 silly addNameRange { name: 'cordova', range: '*', hasData: false }
18 verbose url raw cordova
19 verbose url resolving [ 'http://registry.npmjs.org/', './cordova' ]
20 verbose url resolved http://registry.npmjs.org/cordova
21 info trying registry request attempt 1 at 12:25:02
22 http GET http://registry.npmjs.org/cordova
23 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
24 info trying registry request attempt 2 at 12:25:13
25 http GET http://registry.npmjs.org/cordova
26 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
27 info trying registry request attempt 3 at 12:26:13
28 http GET http://registry.npmjs.org/cordova
29 silly lockFile de8d9fad-cordova cordova@
30 silly lockFile de8d9fad-cordova cordova@
31 error network getaddrinfo ENOTFOUND
31 error network This is most likely not a problem with npm itself
31 error network and is related to network connectivity.
31 error network In most cases you are behind a proxy or have bad network settings.
31 error network
31 error network If you are behind a proxy, please make sure that the
31 error network 'proxy' config is set properly. See: 'npm help config'
32 error System Linux 3.2.0-4-686-pae
33 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova"
34 error cwd /home/usertv
35 error node -v v0.10.24
36 error npm -v 1.3.21
37 error syscall getaddrinfo
38 error code ENOTFOUND
39 error errno ENOTFOUND
40 verbose exit [ 1, true ]
我的 npm 配置 ls -l
; cli configs
long = true
registry = "http://registry.npmjs.org/"
; userconfig /home/usertv/.npmrc
registry = "http://registry.npmjs.org/"
strict-ssl = false
; globalconfig /usr/local/etc/npmrc
registry = "http://registry.npmjs.org/"
; default values
always-auth = false
bin-links = true
browser = null
cache = "/home/usertv/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cert = null
color = true
depth = null
description = true
dev = false
editor = "vi"
email = null
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 = "/usr/local/etc/npmrc"
globalignorefile = "/usr/local/etc/npmignore"
group = 1000
heading = "npm"
https-proxy = null
ignore-scripts = false
init-module = "/home/usertv/.npm-init.js"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
json = false
key = null
link = false
local-address = undefined
loglevel = "http"
; long = false (overridden)
message = "%s"
node-version = "v0.10.24"
npat = false
onload-script = false
optional = true
parseable = false
prefix = "/usr/local"
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-optional = false
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "/bin/bash"
shrinkwrap = true
sign-git-tag = false
; strict-ssl = true (overridden)
tag = "latest"
tmp = "/home/usertv/tmp"
umask = 18
unicode = true
unsafe-perm = true
usage = false
user = 0
user-agent = "node/v0.10.24 linux ia32"
userconfig = "/home/usertv/.npmrc"
username = ""
version = false
versions = false
viewer = "man"
【问题讨论】:
-
尝试运行
curl http://registry.npmjs.org/cordova并确保它输出有效的 JSON。我在这里闻到了网络问题。 -
感谢回复。我不知道我做了什么,但现在只有在尝试全局安装时才会失败。我开始认为这是我工作的 VPN 缓存的某种问题。我使用的是 debian 7,并且我使用网络连接。明天我会再次探测卷曲(刚才我要睡觉了)。
-
Curl 没关系,它返回 JSON。
-
仍然出现这个 f**** 错误。
-
最后我可以通过后续步骤修复:1.sudo gedit /root/.npmrc 将代理设置为 127.0.0.1 ------ 2. npm clear cache ----