1
votes

I am trying to install express framework for node on my Windows system, it always stops with an error:

info it worked if it ends with ok
verbose cli [ 'C:\Program Files (x86)\nodejs\\node.exe',
verbose cli 'C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js', verbose cli 'install', verbose cli '-g', verbose cli
'express' ] info using [email protected] info using [email protected] verbose config file C:\Users\kpatil.npmrc
verbose config file C:\Program Files (x86)\nodejs\etc\npmrc
verbose config file C:\Program Files (x86)\nodejs\node_modules\npm\npmrc verbose mkdir done: C:\Users\kpatil\AppData\Roaming\npm 755 verbose cache add [ 'express', null ] silly cache add: name, spec, args [ undefined, 'express', [ 'express', null ] ]
verbose parsed url { pathname: 'express', path: 'express', href: 'express' } verbose addNamed [ 'express', '' ]
verbose addNamed [ null, '' ] silly name, range, hasData [ 'express', '', false ] verbose raw, before any munging express verbose url resolving [ 'http://registry.npmjs.org/', './express' ]
verbose url resolved http://registry.npmjs.org/express http GET http://registry.npmjs.org/express ERR! Error: failed to fetch from registry: express ERR! at C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\npm-registry-client\get.js:139:12 ERR! at cb (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\npm-registry-client\request.js:32:9) ERR! at Request._callback (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\npm-registry-client\request.js:137:18) ERR! at Request.callback (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\main.js:109:22)
ERR! at Request. (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\main.js:198:58)
ERR! at Request.emit (events.js:88:20) ERR! at ClientRequest. (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\main.js:195:10)
ERR! at ClientRequest.emit (events.js:67:17) ERR! at Socket. (http.js:1134:11) ERR!
at Socket.emit (events.js:67:17)

Any help appreciated...

1
Can you connect to registry.npmjs.org/express in a browser?Eric Bock
No.. tried setting up the proxy too but it didn't workhanskishore

1 Answers

1
votes

Use the advice from Microsoft:

Try npm cache clean first.

If that doesn’t fix things, take a look in %APPDATA%\npm-cache,

or if you’re using PowerShell, $env:APPDATA\npm-cache.

If that doesn't work, use the URI template pattern of the registry JSON to do it manually:

  • Open https://registry.npmjs.org/express/latest in a browser or text editor
  • Search for tgz
  • Copy that URL
  • Paste it into the location bar in a browser to download it
  • Unpack the file using 7zip
  • Copy the npm files to the same path as node

References