Home >Web Front-end >Front-end Q&A >What is the relationship between npm and node.js?

What is the relationship between npm and node.js?

青灯夜游
青灯夜游Original
2022-07-11 18:00:484055browse

The Chinese meaning of npm is "node package manager", which is the default package management tool of the Node.js platform. It will be installed together with Nodejs. npm manages third-party plug-ins corresponding to node.js; you can use npm Install, share, distribute code, and manage node project dependencies.

What is the relationship between npm and node.js?

The operating environment of this tutorial: Windows 7 system, nodejs version 12.19.0, DELL G3 computer.

What is npm? What does it have to do with node.js?

npm (full name Node Package Manager, “node package manager”) is Nodejs’ default software package management system written in JavaScript. npm can be used to install, share, distribute code, and manage project dependencies.

npm is a package management tool in the JavaScript world, and is the default package management tool for the Node.js platform, which will be installed along with Nodejs. Similar to maven, gradle in Java syntax, and pip in python.

npm can solve many problems in NodeJS code deployment. Common usage scenarios include the following:

  • Allow users to download third-party packages written by others from the NPM server Use it locally.

  • Allows users to download and install command line programs written by others from the NPM server for local use.

  • Allows users to upload packages or command line programs they write to the NPM server for others to use.

npm coexists with Nodejs. As long as Nodejs is installed, npm will also be installed. After Nodejs is installed. Open the terminal and execute the following command to check whether the installation is successful.

What is the relationship between npm and node.js?

Extended knowledge: run npm run xxx What happened

  • When running npm run xxx, npm will first search for the program to be executed in node_modules/.bin in the current directory. If found, run it;

  • If not found, start from Search in the global node_modules/.bin, npm i -g xxx is to install it into the global directory;

  • If the global directory is still not found, then check from the path environment variable to see if there is one Other executable programs with the same name.

For more node-related knowledge, please visit: nodejs tutorial!

The above is the detailed content of What is the relationship between npm and node.js?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn