首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >角2的npm封装安装误差

角2的npm封装安装误差
EN

Stack Overflow用户
提问于 2016-04-20 08:12:45
回答 1查看 887关注 0票数 0

我在公司代理防火墙后面,每当我在命令提示符中输入npm安装命令时,我就会收到这个错误。以前,它允许我编辑具有代理设置的npm文件,现在无论输入什么npm命令,我都会得到这个错误:

代码语言:javascript
复制
URIError: URI malformed
at decodeURIComponent <native>    
at Url.parse <url.js:261:19>
at Object.urlParse [as parse] (url.js:67:5)
at Object.validateUrl [as validate] (C:\Program F
m\node_modules\nopt\lib\nopt.js:164:13)
 at validate (C:\Program Files\nodejs\node_modules
 nopt.js:213:24)
at validate (C:\Program Files\nodejs\node_modules
nopt.js:179:11)
at C:\Program Files\nodejs\node_modules\npm\node_
1:12
at Array.map (native)
at C:\Program Files\nodejs\node_modules\npm\node_
:15
at Array.forEach (native)

C:\Program Files\nodejs\node_modules\npm\lib\npm.js:3
  throw new Error('npm.load() required')
  ^

Error: npm.load() required
at Object.npm.config.get (C:\Program Files\nodejs
 s:37:13)
at exit (C:\Program Files\nodejs\node_modules\npm
:60:40)
at process.errorHandler (C:\Program Files\nodejs\
 error-handler.js:178:3)
at emitOne (events.js:90:13)
at process.emit (events.js:182:7)
at process._fatalException (node.js:236:26)

-调查结果--

发现它与c:\user{username} .npmrc文件有关。从该文件中删除代理设置会使错误消失,但随后我无法下载任何包。

-nprmc文件--

代码语言:javascript
复制
;;;;
; npm userconfig file
; this is a simple ini-formatted file
; lines that start with semi-colons are comments.
; read `npm help config` for help on the various options
;;;;

proxy=http://192.168.240.192:8080/
registry=http://registry.npmjs.org/


;;;;
; all options with default values
;;;;
; access=null

; always-auth=false

; also=null

; bin-links=true

; browser=null

; ca=null

; cafile=undefined

; cache=C:\Users\test\AppData\Roaming\npm-cache

; cache-lock-stale=60000

; cache-lock-retries=10

; cache-lock-wait=10000

; cache-max=null

; cache-min=10

; cert=null

; color=true

; depth=null

; description=true

; dev=false

; dry-run=false

; editor=notepad.exe

; engine-strict=false

; force=false

; fetch-retries=2

; fetch-retry-factor=10

; fetch-retry-mintimeout=10000

; fetch-retry-maxtimeout=60000

; git=git

; git-tag-version=true

; global=false

; globalconfig=C:\Users\test\AppData\Roaming\npm\etc\npmrc

; global-style=false

; group=0

; heading=npm

; if-present=false

; ignore-scripts=false

; init-module=C:\Users\test\.npm-init.js

; init-author-name=

; init-author-email=

; init-author-url=

; init-version=1.0.0

; init-license=ISC

; json=false

; key=null

; legacy-bundling=false

; link=false

; local-address=undefined

; loglevel=warn

; long=false

; maxsockets=50

; message=%s

; node-version=5.10.1

; npat=false

; onload-script=null

; only=null

; optional=true

; parseable=false

; prefix=C:\Program Files\nodejs

; production=false

; progress=true

; proprietary-attribs=true

; proxy=null

; https-proxy=null

; user-agent=npm/{npm-version} node/{node-version} {platform} {arch}

; rebuild-bundle=true

; registry=https://registry.npmjs.org/

; rollback=true

; save=false

; save-bundle=false

; save-dev=false

; save-exact=false

; save-optional=false

; save-prefix=^

; scope=

; searchopts=

; searchexclude=null

; searchsort=name

; shell=C:\WINDOWS\system32\cmd.exe

; shrinkwrap=true

; sign-git-tag=false

; strict-ssl=true

; tag=latest

; tag-version-prefix=v

; tmp=C:\Users\test\AppData\Local\Temp

; unicode=false

; unsafe-perm=true

; usage=false

; user=0

; userconfig=C:\Users\test\.npmrc

; umask=0

; version=false

; versions=false

; viewer=browser

; _exit=true

; globalignorefile=C:\Users\test\AppData\Roaming\npm\etc\npmignore
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-20 08:20:41

发现它与c:\usrs{username}.npmrc文件有关。从该文件中删除代理设置会使错误消失,但随后我无法下载任何包。

避免通过所有这些步骤并使其在企业代理之后工作的最佳方法是使用CNTLM,用户KOL在这里回答:NPM behind NTLM proxy

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36737692

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档