我正在尝试安装npm软件包
npm ERR! code EHOSTUNREACH
npm ERR! errno EHOSTUNREACH
npm ERR! request to https://registry.npmjs.org/express-session failed, reason: connect EHOSTUNREACH 104.16.23.35:443 - Local (192.0.108.1:52659)
我尝试将npm配置重置为默认值。我也尝试过安装/出vpn,但仍然没有工作。
以下是配置:
; userconfig /Users/mac/.npmrc
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "/Users/mac/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = 0
cache-min = 10
cafile = "/Users/mac/Projects/NodeProjects/Bloggy/undefined"
cert = null
cidr = null
color = true
commit-hooks = true
depth = 0
description = true
dev = false
dry-run = false
editor = "vi"
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
global-style = false
globalconfig = "/usr/local/etc/npmrc"
globalignorefile = "/usr/local/etc/npmignore"
group = 20
ham-it-up = false
heading = "npm"
https-proxy = null
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "/Users/mac/.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
long = false
maxsockets = 50
message = "%s"
node-options = null
node-version = "10.15.3"
noproxy = null
offline = false
onload-script = null
only = null
optional = true
otp = null
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
prefix = "/usr/local"
preid = ""
production = false
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "/bin/bash"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "/var/folders/qc/f1s84bcj5y10v57pvz0s4st40000gn/T"
umask = 18
unicode = true
unsafe-perm = true
update-notifier = true
usage = false
user = 0
userconfig = "/Users/mac/.npmrc"
version = false
versions = false
viewer = "man"
我在试图解决这个问题时设置了这些值,但仍然无法工作。我可能需要说,国家预防机制在此之前运作得很好。
发布于 2021-08-14 16:57:10
我在ubuntu (wsl)
上也有同样的问题。
试试看:
$ ping registry.npmjs.org
$ npm view npm version
如果ping不成功,则有多个选项:
对我来说,这是代理,我不得不禁用选项检测自动设置
发布于 2019-07-06 13:31:32
要回答您的问题,您在连接registry.npmjs.org时遇到了问题。
尝试启动下面的命令(考虑到您使用的是windows)。
如果第一个命令返回“无法到达的目标主机”,则在防火墙后面,并阻止您到达服务器。
此外,您还可以检查.npmrc条目或npm配置ls。
https://stackoverflow.com/questions/56911529
复制相似问题