407 Proxy Authentication Required – GET http://registry.npmjs.org/deep-extend[亲测有效]

407 Proxy Authentication Required – GET http://registry.npmjs.org/deep-extend[亲测有效]$npminstallnpmWARNclient-tool@1.0.0NodescriptionnpmWARNclient-tool@1.0.0Norepositoryfield.npmERR!codeE407npmERR!407ProxyAuthenticationRequired-GEThttp://registry.npmjs.org/…

大家好,欢迎来到IT知识分享网。

$ npm install 
npm WARN client-tool@1.0.0 No description
npm WARN client-tool@1.0.0 No repository field.

npm ERR! code E407
npm ERR! 407 Proxy Authentication Required - GET http://registry.npmjs.org/deep-extend

新电脑,安装一些包,直接说407
需要代理身份验证-无法通过公司代理

所以npm config rm registry

重新配置,镜像源,切换成官网的:

npm config set registry https://registry.npmjs.org/

然而不解决问题

$ npm config get registry
https://registry.npmjs.org/

houhongf@MINGW64 /c/zoeCode/nfcclienttools (master)
$ npm install
npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN client-tool@1.0.0 No description
npm WARN client-tool@1.0.0 No repository field.

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/abbrev failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
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 config set registry https://registry.npm.taobao.org/

install 还是会报错

$ npm install
npm WARN client-tool@1.0.0 No description
npm WARN client-tool@1.0.0 No repository field.

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npm.taobao.org/aproba failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org
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'

node.js需要走环境代理,需要单独配置代理:
命令行:
proxy.com 公司代理地址
port : 代理的端口号

npm config set proxy http://proxy.com:port;
npm config set https-proxy http://proxy.com:port;

配置完,去install:

$ npm install
npm WARN client-tool@1.0.0 No description
npm WARN client-tool@1.0.0 No repository field.

npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npm.taobao.org/concat-stream failed, reason: self signed certificate in certificate chain

上述问题,可以看https://blog.npmjs.org/post/78085451721/npms-self-signed-certificate-is-no-more,不晓得能否解决问题

看到有人说通过以下命令可以解决

npm config set strict-ssl false

然而,npm install又报错了

$ npm install

> buffertools@2.1.6 install C:\zoeCode\nfcclienttools\node_modules\buffertools
> node-gyp rebuild


C:\zoeCode\nfcclienttools\node_modules\buffertools>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: self signed certificate in certificate chain
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1321:34)
gyp ERR! stack     at TLSSocket.emit (events.js:210:5)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:794:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:608:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\zoeCode\nfcclienttools\node_modules\buffertools
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN client-tool@1.0.0 No description
npm WARN client-tool@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! buffertools@2.1.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buffertools@2.1.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

如果公司代理需要登录,那么需要设置用户名和密码,命令如下:
可以参考网址:https_proxy的格式

username 用户名,登录电脑的用户名
password 上网密码
proxy.com 公司代理地址
port 端口号

npm config set proxy http://username:password@proxy.com:port;
npm config set https-proxy http:///username:password@proxy.com:port;

可以参考状态码意思:http状态码
参考一些node错:node报错

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/24545.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信