Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of npm in linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "what is the concept of npm in linux". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "what is the concept of npm in linux" can help you solve the problem.

In linux, npm is a package management tool installed with nodejs. The main function is to manage node packages, including: install, uninstall, update, view, etc.; it allows users to download third-party packages that have been written from the npm server for local use.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What does npm mean in linux

NPM is a package management tool installed with NodeJS, which can solve many problems in NodeJS code deployment. Common usage scenarios are as follows:

Allows users to download third-party packages written by others from the NPM server for local use.

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

Allows users to upload their own packages or command-line programs to the NPM server for others to use.

Since the new version of nodejs has been integrated with npm, npm has been installed before. You can also test whether the installation is successful by typing "npm-v". The command is as follows, and a version prompt indicates that the installation is successful:

$npm-v2.3.0

If you are installing an older version of npm, you can easily upgrade it with the npm command, as follows:

$sudo npm install npm- g/usr/local/bin/npm-> / usr/local/lib/node_modules/npm/bin/npm-cli.jsnpm@2.14.2 / usr/local/lib/node_modules/npm

NPM (node package manager), commonly known as the node package manager. As the name implies, its main function is to manage node packages, including: install, uninstall, update, view, search, publish, and so on.

Behind npm is a database based on couchdb, which records the information of each package in detail, including author, version, dependency, authorization information, and so on. One of its important functions is to liberate developers from the tedious work of package management (versions, dependencies, etc.) and focus more on functional development.

Npm install installs dependent packages for nodejs

For example, npm install express will install the latest version of express by default, or you can install a specified version by adding the version number, such as npm install express@3.0.6

Npm install-g installs the package into the global environment

But in the code, there is no way to call a globally installed package directly through require (). The global installation is for the command line, just as after you have installed vmarket globally, you can run the vm command directly from the command line

Npm install-when save is installed, the information is written to package.json

If there is a package.json file in the project path, you can directly use the npm install method to install all dependent packages according to the dependencies configuration

This way, when the code is submitted to github, you don't have to submit the node_modules folder.

Npm init will guide you to create a package.json file, including the name, version, author, and so on.

Npm remove removal

Npm update update

Npm ls lists all currently installed packages

Npm root to view the installation path of the current package

Npm root-g View the installation path of the global package

Npm help help, if you want to view the help of the install command separately, you can use the npm help install of

This is the end of the introduction to "what is the concept of npm in linux". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report