Here is my problem. We have a private NPM registry which only works in VPN. I would like to have a fallback registry https://registry.npmjs.org so that when I am out of VPN
My approach was to make a slight command line variant that adds the registry switch.
I created these files in the nodejs folder where the npm executable is found:
npm-.cmd
:
@ECHO OFF
npm --registry https://registry.npmjs.org %*
npm-
:
#!/bin/sh
"npm" --registry https://registry.npmjs.org "$@"
Now, if I want to do an operation against the normal npm registry (while I am not connected to the VPN), I just type npm-
where I would usually type npm
.
To test this command and see the registry for a package, use this example:
npm- view lodash
PS. I am in windows and have tested this in Bash, CMD, and Powershell. I also