Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "npm set registry https://registry.npmjs.org/" do?

I had problem installing cordova using npm.

From the answer found here, the trick is to run npm set registry https://registry.npmjs.org/ What exactly does this command do and why does it solve the problem of installing cordova?

Stuck when installing cordova

like image 729
user1315789 Avatar asked Feb 26 '18 11:02

user1315789


People also ask

What does npm set registry do?

The public npm registry is a database of JavaScript packages, each comprised of software and metadata. Open source developers and developers at companies use the npm registry to contribute packages to the entire community or members of their organizations, and download packages to use in their own projects.

What does npmjs stand for?

The name npm (Node Package Manager) stems from when npm first was created as a package manager for Node. js. All npm packages are defined in files called package. json.

What is https Npmjs com?

npm is the package manager for Node. js. It was created in 2009 as an open source project to help JavaScript developers easily share packaged modules of code. The npm Registry is a public collection of packages of open-source code for Node.

What is the npm registry URL?

npm is configured to use the npm public registry at https://registry.npmjs.org by default.


1 Answers

As you can read here, the npm Registry is a public collection of packages of open-source code for Node.js, front-end web apps and the JavaScript community at large.

In a standard install of npm, the registry is set to https://registry.npmjs.org/. That is to say, this is the address that npm will download packages from when you run npm install <anything>.

You can however change this value with the command npm set registry <new url>. That means that any future npm install commands will fetch packages from <new url> instead. You might want to do this if your company runs its own private mirror of the registry, or if you want to use a different mirror in the case that https://registry.npmjs.org/ is down, or too slow. This SO answer lists a couple of alternative mirrors.

the trick is to run npm set registry https://registry.npmjs.org/ What exactly does this command do and why does it solve the problem of installing cordova?

This command resets the registry value to its default and causes npm to download packages from https://registry.npmjs.org/. Why this solved your particular problem is hard to say, as https://registry.npmjs.org/ is the default value for a new install of npm. It seems something changed this value on your computer, but without further information it is difficult to say what.

In future, you can also check what this value is set to using npm get registry.

like image 75
James Hibbard Avatar answered Dec 11 '22 07:12

James Hibbard