Using npm behind a firewall using Visual Studio 2015

I am trying to use the new npm support in Visual Studio 2015, but are facing some problems. I am located behind the corporate firewall.

I tried to add "grunt" from the package.json file and see this npm related result.

npm http GET https://registry.npmjs.org/grunt npm http GET https://registry.npmjs.org/grunt-bower-task npm http GET https://registry.npmjs.org/grunt-contrib-cssmin npm http GET https://registry.npmjs.org/grunt-bower-task npm http GET https://registry.npmjs.org/grunt-contrib-cssmin npm http GET https://registry.npmjs.org/grunt npm http GET https://registry.npmjs.org/grunt npm http GET https://registry.npmjs.org/grunt-bower-task npm http GET https://registry.npmjs.org/grunt-contrib-cssmin npm ERR! Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE npm ERR! at SecurePair.<anonymous> (tls.js:1367:32) npm ERR! at SecurePair.emit (events.js:92:17) npm ERR! at SecurePair.maybeInitFinished (tls.js:979:10) npm ERR! at CleartextStream.read [as _read] (tls.js:471:13) npm ERR! at CleartextStream.Readable.read (_stream_readable.js:340:10) npm ERR! at EncryptedStream.write [as _write] (tls.js:368:25) npm ERR! at doWrite (_stream_writable.js:225:10) npm ERR! at writeOrBuffer (_stream_writable.js:215:5) npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:182:11) npm ERR! at write (_stream_readable.js:601:24) npm ERR! If you need help, you may report this *entire* log, npm ERR! including the npm and node versions, at: npm ERR! <http://github.com/npm/npm/issues> npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\Microsoft\\Web Tools\\External\\\\node\\node" "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\Extensions\\Microsoft\\Web Tools\\External\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! cwd C:\Data\Develop\Playground\WebBasics2 npm ERR! node -v v0.10.31 npm ERR! npm -v 1.4.9 npm 

I saw some posts where you can configure node to ignore SSL, but don’t know how to do it in Visual Studio 2015.

Please help Best regards, Thomas

+5
npm visual-studio-2015
source share
2 answers

The following steps will work for VS 2015

1- Run the command line as Administrator

2- go to Path of External tools for VS 2015 in your case it is "C: \ Program Files (x86) \ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ Extensions \ Microsoft \ Web Tools \ Editors

3-npm config set ca = ""

4- npm config set strict-ssl false

5- npm install npm -g --ca = null

+4
source share

In my case, the above solution did not work. It worked after updating the .npmrc file and when starting npm using Fiddler. Here are the steps that worked for me:

  • After installing npm, update the .npmrc file located in the C: \ Users \ 'username' directory:

registry = http://registry.npmjs.org

proxy = http://127.0.0.1:8888

https-proxy = http://127.0.0.1:8888

http-proxy = http://127.0.0.1:8888

strict = false false

  • Open Fiddler, and on the Rules tab, select Automomatically Authenticate. Don't forget that Fiddler is listening on port 8888.
  • When opening Fiddler, the npm shouwl command works fine in Visual Studio

This should work behind a corporate firewall with domain-joined systems.

+5
source share

All Articles