"npm config set registry https://registry.npmjs.org/" does not work in bat bat file

I am creating a.bat for Windows 7, the contents of a.bat:

@echo off npm config set registry https://registry.npmjs.org/ 

and then run a.bat but it doesn’t work, I think the word “set” is a special keyword for npm and bat, are there any methods to solve this issue?

+153
npm batch-file
Mar 13 '14 at 16:34
source share
9 answers

You should not modify the npm registry using .bat files. Instead, try using the .npmrc file, which is the configuration for npm . The correct command to modify the registry is

npm config set registry <registry url>

you can find more information using the npm help config command, and also check privileges when and if you work with .bat files this way.

+186
Mar 13 '14 at 21:07
source

We can also run npm install with registry parameters for several custom registry URLs.

 npm install --registry=https://registry.npmjs.org/ npm install --registry=https://custom.npm.registry.com/ 
+62
May 09 '17 at a.m.
source

You can change it with .bat by running the call command beforehand, hope this helps anyone in the future do similar .bat commands

 call npm config set registry https://registry.npmjs.org/ 
+50
Apr 01 '15 at 17:39
source

In version 4.4.1 you can use:

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

Where @myco is the area of ​​your package. You can install the package as follows:

 npm install @myco/my-package 

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

+15
Mar 14 '17 at 17:30
source

Perhaps I was late to answer. But if someone needs it, then after work it’s fine, because I used it many times.

 npm config set registry=https://registry.npmjs.com/ 
+10
Jul 20 '17 at 3:46 on
source

In npm version 3.7.3

npm set registry=http://whatever/

+6
Apr 18 '16 at 10:58
source

By executing your .bat, you are configuring only for this session not globally. When you open and invite another cmd and run npm install , this config will not be installed for this session, so change your .bat file as

 @echo off npm config set registry https://registry.npmjs.org/ @cmd.exe /K 
+2
Aug 02 '17 at 9:50
source
 2.name can no longer contain capital letters 

do not use capital letters for your package:

 npm install --save uex 

use this:

 npm install --save vuex 
0
Aug 17 '19 at 9:21
source
 npm config set registry=https://registry.npmjs.com/ 

Add the line "registry = https://registry.npmjs.com/ " to your .npmrc configuration file

-3
Jun 20 '18 at 13:37
source



All Articles