Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"npm config set registry https://registry.npmjs.org/" is not working in windows bat file

People also ask

Where is npm registry setup?

npm is configured to use the npm public registry at https://registry.npmjs.org by default. Use of the npm public registry is subject to terms of use available at https://docs.npmjs.com/policies/terms. You can configure npm to use any compatible registry you like, and even run your own registry.

What is npm default registry?

The default is typically set to the public npm registry at https://registry.npmjs.org/ . For more information about npm configuration files, see the npm config file documentation.

Where is npm config file windows?

The prefix config defaults to the location where node is installed. On most systems, this is /usr/local . On Windows, it's %AppData%\npm .


You shouldn't change the npm registry using .bat files. Instead try to use modify the .npmrc file which is the configuration for npm. The correct command for changing registry is

npm config set registry <registry url>

you can find more information with npm help config command, also check for privileges when and if you are running .bat files this way.


We can also run npm install with registry options for multiple custom registry URLs.

npm install --registry=https://registry.npmjs.org/ 
npm install --registry=https://custom.npm.registry.com/ 

You can change using the .bat make sure you run the call command prior, hopefully this helps anyone in future making similar .bat commands

call npm config set registry https://registry.npmjs.org/

On version 4.4.1, you can use:

npm config set @myco:registry=http://reg.example.com

Where @myco is your package scope. You can install package in this way:

npm install @myco/my-package

ref: https://docs.npmjs.com/misc/scope


Probably I am too late to answer. But if anybody need it, following works fine, as I have used it a lot of times.

npm config set registry=https://registry.npmjs.com/