Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Config List: environment configs - REGISTRY

In my C:\Users\XXXXXX.npmrc file, I have the following settings;

https-proxy=http://proxy.server.com:0000
http-proxy=http://proxy.server.com:0000
strict-ssl=false

The proxy has been verified as correct and when I attempt to install an item from the Node Package Manager to a directory that contains a package.json file, I receive the following error:

npm REGISTRY json parsing error

When I attempt to see my npm configurations, I use the following command:

npm config list

and see the following settings:

;cli configs
user-agent = "npm/2.15.5 node/v4.4.5 win32 x64"

; environment configs
cache = "C:\\LOCATION"
prefix = "C:\\LOCATION"
registry = "http://another.proxy.server:0000"

; userconfig C:\Users\USERNAME\.npmrc
https-proxy = "https://proxy.server.com:0000
http = "http://proxy.server.com:0000
rejectUnauthorized=false
strict-ssl=false

;builtin config defined

;node bin location = C:\LOCATION
;cwd = C:\LOCATOIN
;HOME = C:\LOCATION
; 'npm config ls -l' to show all defaults.

I am able to change the registry using the following command:

npm config set registry http://registry.npmjs.org

However, when I run the following command:

npm config list

It still lists the other proxy as the default.

Any ideas?

UPDATE

After viewing other threads, I decided to see all of the NPM default configurations in detail by using the following command:

npm config ls -l

Once running this command, I see the following entry (which I could not see running the previous command) for the registry configuration:

; registry = "https://registry.npmjs.org/" (overridden)

Does anyone have any idea why the registry would be overridden or common applications/locations that would do such a thing?

like image 934
Mindsect Team Avatar asked Feb 09 '17 12:02

Mindsect Team


1 Answers

The line that you are seeing from 'npm config ls -l' shows that the default value of registry is 'https://registry.npmjs.org/'. When you ran the command 'npm config set registry http://registry.npmjs.org', you overrode that value. You should see a line in the userconfig section of the ls output that shows that you set the 'registry' value in your user config. It also looks like the registry is being overridden by an environment variable that probably overrides both the default config and the user config (what you are setting with the 'config set' command).

like image 170
Sam Avatar answered Nov 14 '22 21:11

Sam