Regensburg, Germany - 2021-04-09
npm
yarn
node modules
corporate firewall

Disclaimer

I'm no System Administrator but rather a (Web-) Developer! Which means that firewall isn't a topic i know more that the bare minimum. Don't naively follow this guide and paste commands, but rather think about the consequences of these commands. Remember, you work in a professional environment which can be targeted by hackers in order to get sensible informations or control. You might risk yourself becoming a security hole for your company!
If you're unsure about anything, ask your Company's IT Department nicely about what you're about to do and what they think of it.

Foreword

I've had alot of trouble installing NPM Modules on my windows notebook from the company i was working for. After alot of research and troubleshooting i could nail the problem and install packages.
Pls also install yarn. It is a much more mature and automatically retries if a package times out and continues with the other if one fails. There are many more Reasons

Problem - Firewall blocks downloading the package

Sorry to tell you: ask your company's IT Department! Reasons are:
  • You propably cannot bypass your company's firewall
  • You should not bypass your company's firewall. You risk becoming a security hole.
  • They can whitelist the npm repo
  • Maybe they already set up a npm enterprise registry

Resolve Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN

I assume this is a result of a repackaged "package" that is signed by your companys firewall.
Option 1: add your certificate to your npm/yarn config
Do you have access to your certificate? Great, you can tell yarn/npm to use it and your problems should be resolved. use windows certificates with node js - medium
Option 2: disable strict ssl
  • Disable strict-ssl for your package manager (interchange npm for yarn)
  • Increase Network Timeout because looking into a package takes time.
  • Disable TLS Authorization for node js (Some packages download tools afterwards)
Powershell:
yarn config set "strict-ssl" false yarn config set "network-timeout" 600000 $env:NODE_TLS_REJECT_UNAUTHORIZED=0
Search
Dominik Stötter
Developer by day. Photographer at golden hour. Occasional word wrangler after dark.

Wan·der·lust

/ˈwändərˌləst/
Noun, feminine [the]Desire, joy of hikingA small blog from a fulltime developer, photography hobbyist and horrible blog author. Also, this domain wasn't taken...