network request to https://registry.npmjs.org/fstompjs failed, reason: connect ETIMEDOUT 104

  • 1、背景

使用npm下载@stomp/ng2-stompjs --》

npm install @stomp/ng2-stompjs --save 一直报错

报错信息如下

D:\code\ng-video-ai>npm install @stomp/ng2-stompjs --save
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/@stomp%2fstompjs failed, reason: connect ETIMEDOUT 104.16.16.35:443
npm ERR! network This is a problem 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! A complete log of this run can be found in:
npm ERR!     D:\Program Files\nodejs\node_cache\_logs\2018-07-26T06_37_54_392Z-debug.log
  • 2、原因:npm配置了代理

使用"npm config list -l"命令查看npm配置

; cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/5.5.1 node/v8.9.0 win32 x64"

; userconfig C:\Users\cy\.npmrc
cache = "D:\\Program Files\\nodejs\\node_cache"
https-proxy = "http://proxy-server-address:8080/"
prefix = "D:\\Program Files\\nodejs\\node_global"
proxy = null

; builtin config undefined
; prefix = "C:\\Users\\cy\\AppData\\Roaming\\npm" (overridden)

; default values
access = null
allow-same-version = false
also = null
always-auth = false
auth-type = "legacy"
bin-links = true
browser = null
ca = null
; cache = "C:\\Users\\cy\\AppData\\Roaming\\npm-cache" (overridden)
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "notepad.exe"
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 = "D:\\Program Files\\nodejs\\node_global\\etc\\npmrc"
globalignorefile = "D:\\Program Files\\nodejs\\node_global\\etc\\npmignore"
group = 0
ham-it-up = false
heading = "npm"
; https-proxy = null (overridden)
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\cy\\.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 (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-version = "8.9.0"
offline = false
onload-script = null
only = null
optional = true
otp = 0
package-lock = true
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "D:\\Program Files\\nodejs" (overridden)
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 = "C:\\WINDOWS\\system32\\cmd.exe"
shrinkwrap = true
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\\Users\\cy\\AppData\\Local\\Temp"
umask = 0
unicode = false
unsafe-perm = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
userconfig = "C:\\Users\\cy\\.npmrc"
version = false
versions = false
viewer = "browser"

其中有这条配置https-proxy = "http://proxy-server-address:8080/" 

使用"npm config delete https-proxy"命令删除即可正常下载

 

你可能感兴趣的:(node.js,工具)