0

I am behind a corporate proxy firewall and i am getting this error whenever i enter npm install command in command prompt. previously it would let me edit the npm file which had the proxy settings and now i am getting this error no matter what npm command i enter:

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)

--findings--

found out that it has something to do with c:\users{username} .npmrc file. deleting the proxy settings from this file makes the error go away but then i cannot download any packages.

--nprmc file--

;;;;
; 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
kemsky
  • 14,727
  • 3
  • 32
  • 51
Baahubali
  • 4,604
  • 6
  • 33
  • 72

1 Answers1

0

found out that it has something to do with c:\usrs{username}.npmrc file. deleting the proxy settings from this file makes the error go away but then i cannot download any packages.

Best way to avoid going through all these steps and to get it work behind corporate proxy is to use CNTLM as answered by user KOL here: NPM behind NTLM proxy

Community
  • 1
  • 1
Baahubali
  • 4,604
  • 6
  • 33
  • 72