Is there any way to change or reset the global npm registry.
Appreciate your assistance.
Is there any way to change or reset the global npm registry.
Appreciate your assistance.
Run the following command in your terminal to revert back to the default regsitry
npm config set registry https://registry.npmjs.org/
or
npm config delete registry
registry="https://registry.npmjs.org/"
worked for me. Thanks. –
Undulate If you are on windows, other than setting the registry, you can also delete the .npmrc
file to reset the registry.
You can find this file at C:\Users\<Your User Name>\.npmrc
~/.npmrc
and deleting it also works –
Concertgoer Sets a configuration key to a value
npm config set <key> <value> [-g|--global]
Gets the value of an existing configuration key
npm config get <key>
Deletes the key from all configuration files.
npm config delete <key>
Lists all the config settings,could be used to check for existing config entries
npm config list
Opens the config file in an editor.
npm config edit
All that would help make changes to the npm registry
Hope that helps!
Yes...
You can use this
$(npm config get globalconfig)
npm config --global edit
What I accidentally tried and it's working fine is
npm config set registry
Just it, without any additional parameters.
For Mac,
Go to /Users/<user_name>
Create a .npmrc file (or edit if already created)
These are the default values which I change usually for most of my projects:
registry=https://registry.npmjs.org
legacy-peer-deps=false
In my experience, I had to use a private NPM registry for security reasons and while switching projects I had to change my registry and found that I was unable to! A requirement of the private registry was to be on a VPN network so to be able to connect to the private registry.
Command I was trying to run
npx sb init --builder webpack5
I was trying to install storybook in an existing project.
I tried and failed by:
npm config set registry https://registry.npmjs.org
commands even with --location=
set to project, user, global.npmrc
with npm_config_registry=https://registry.npmjs.org
value in multiple locationsyarn
wouldn't change the registry and I also tried to use the yarn specific commands as well yarn config set ...
Information about my environment:
npm
not yarn
What ended up fixing my problem
2. I ended up reconnecting to the VPN so that when I ran my npx ...
command from above it would still download the packages through my private registry
3. rm -rf node_modules package-lock.json
I removed the installed files and lockfile
4. I disconnected from my VPN and re-installed packages with the same npx ...
command
5. I see now that the packages are properly pulling from https://registry.npmjs.org
For some reason NPM wanted to resolve something from the private registry I had before finally using the newly configured public registry.
Might be a bug with NPM that I do not have the experience nor time to troubleshoot though I wanted to share my experience here in hopes it will help someone with a similar experience.
© 2022 - 2025 — McMap. All rights reserved.