npm下载安装教程_npm下载,安装和使用教程
npm下載安裝教程
nodejs is a popular javascript platform and framework which provides server and client-side libraries. What makes nodejs so successful is its package manager named npm or nodejs package manager. npm provides easily install, update and remove packages and load libraries according to the application configuration.
nodejs是流行的javascript平臺和框架,提供服務器和客戶端庫。 使nodejs如此成功的原因是其名為npm軟件包管理器或nodejs軟件包管理器。 npm可根據應用程序配置輕松安裝,更新和刪除軟件包以及加載庫。
為Ubuntu,Debian,Mint,Kali安裝Npm軟件包 (Install Npm Package For Ubuntu, Debian, Mint, Kali)
We can install npm package with the apt command where Ubuntu, Debian, Mint, Kali distributions support.
我們可以使用apt命令安裝npm軟件包,其中支持Ubuntu,Debian,Mint,Kali發行版。
$ sudo apt install npm Install Npm Package For Ubuntu, Debian, Mint, Kali為Ubuntu,Debian,Mint,Kali安裝Npm軟件包為Fedora,CentOS,RedHat安裝Npm軟件包(Install Npm Package For Fedora, CentOS, RedHat)
For yum based distributions we will use yum or dnf command like below where we will install npm package.
對于基于yum的發行版,我們將使用yum或dnf命令(如下所示)在其中安裝npm軟件包。
$ sudo yum install npmOR
要么
$ sudo dnf install npm Install Npm Package For Fedora, CentOS, RedHat為Fedora,CentOS,RedHat安裝Npm軟件包打印npm一般幫助信息(Print npm General Help Information)
npm command provides different type of commands or options in order to manage nodejs packages. We can get general information about these command with the -h option.
npm命令提供了不同類型的命令或選項,以管理nodejs軟件包。 我們可以使用-h選項獲得有關這些命令的常規信息。
$ npm -h Print npm General Help Information打印npm一般幫助信息獲取npm的特定命令或選項幫助(Get Specific Command or Option Help For npm)
In the previous example, we have listed generic information about the npm commands and options. We may need a more detailed help about these commands or options which can be listed with the COMMAND -h . In this example, we will list detailed help about the searchcommand.
在前面的示例中,我們列出了有關npm命令和選項的一般信息。 關于這些命令或選項,我們可能需要更詳細的幫助,這些命令或選項可以與COMMAND -h一起列出。 在此示例中,我們將列出有關search命令的詳細幫助。
$ npm search -h Get Specific Command or Option Help For npm獲取npm的特定命令或選項幫助使用npm搜索A軟件包(Search For A Packages with npm)
We can search for a specific package for installation with the search command or option. In this example, we will search the term angular.
我們可以使用search命令或選項search要安裝的特定軟件包。 在此示例中,我們將搜索術語angular 。
$ npm search angular Search For A Packages with npm使用npm搜索A軟件包We can see that search results are printed and listed in a structured column. This search results will present the following information.
我們可以看到搜索結果已打印并列在結構化列中。 該搜索結果將顯示以下信息。
NAME is the package full name like angular, angular-strap etc.
NAME是軟件包的全名,例如angular , angular-strap等。
DESCRIPTION is the info about the package what is it.
DESCRIPTION是有關包裝信息的信息。
AUTHOR is the package creator’s name or team name.
AUTHOR是包創建者的名稱或團隊名稱。
DATE is the last time the package is updated.
DATE是軟件包的最后更新時間。
VERSION is the version number of the package which is the latest.
VERSION是軟件包的最新版本號。
KEYWORDS are some tags that describe and related to the package.
KEYWORDS是一些描述軟件包并與軟件包相關的標簽。
使用npm安裝單個軟件包 (Install Single Package with npm)
We can install packages with the install npm command or options by providing the package full name. In this example, we will install the package named angular.
我們可以通過提供軟件包全名來使用install npm命令或選項來安裝軟件包。 在此示例中,我們將安裝名為angular的軟件包。
$ npm install angular Install Single Package with npm使用npm安裝單個軟件包We can see that after the package installation is complete the installed package name with is angular and the version installed which is 1.7.8 are printed to the console.
我們可以看到,在軟件包安裝完成后,已安裝的軟件包名稱(帶有angular和已安裝的版本1.7.8被打印到控制臺。
使用npm在package.json中安裝所有項目依賴項 (Install All Project Dependencies in package.json with npm)
package.json provides the list of the packages which is required for a project. In order to run this project, the packages should be installed. npm command can install packages listed in this package.json easily.
package.json提供了項目所需的軟件包列表。 為了運行此項目,應安裝軟件包。 npm命令可以輕松安裝此package.json列出的軟件包。
{"name": "node-js-sample","version": "0.2.0","description": "A sample Node.js app using Express 4","main": "index.js","scripts": {"start": "node index.js"},"dependencies": {"express": "^4.13.3"},"engines": {"node": "4.0.0"},"repository": {"type": "git","url": "https://github.com/heroku/node-js-sample"},"keywords": ["node","heroku","express"],"author": "Mark Pundsack","contributors": ["Zeke Sikelianos <[email?protected]> (http://zeke.sikelianos.com)"],"license": "MIT" }We can simply use install command which will automatically look for package.json and install the required packages.
我們可以簡單地使用install命令,它將自動查找package.json并安裝所需的軟件包。
$ npm install使用npm更新軟件包 (Update Packages with npm)
Updating packages with the npm is easy as installing them. We will provide the package name we want to update to the update command or option. In this example, we will update the package named angular.
使用npm更新軟件包就像安裝它們一樣容易。 我們將要更新的包名稱提供給update命令或選項。 在此示例中,我們將更新名為angular的包。
$ npm update angular更新nmp (Update nmp)
Update nmp?更新nmpnpm can install and update different JavaScript libraries. npm can also update itself like a normal package. We will use i option and provide the package name as npm like below.
npm可以安裝和更新不同JavaScript庫。 npm也可以像普通軟件包一樣進行自我更新。 我們將使用i選項,并將軟件包名稱提供為npm如下所示。
$ npm i npm Update npm更新npmWe can see from the output that the current version is updated to the 6.9.0 .
從輸出中我們可以看到當前版本已更新為6.9.0。
.u0f03045539324c6a83cc9d541011a854 , .u0f03045539324c6a83cc9d541011a854 .postImageUrl , .u0f03045539324c6a83cc9d541011a854 .centered-text-area { min-height: 80px; position: relative; } .u0f03045539324c6a83cc9d541011a854 , .u0f03045539324c6a83cc9d541011a854:hover , .u0f03045539324c6a83cc9d541011a854:visited , .u0f03045539324c6a83cc9d541011a854:active { border:0!important; } .u0f03045539324c6a83cc9d541011a854 .clearfix:after { content: ""; display: table; clear: both; } .u0f03045539324c6a83cc9d541011a854 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u0f03045539324c6a83cc9d541011a854:active , .u0f03045539324c6a83cc9d541011a854:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u0f03045539324c6a83cc9d541011a854 .centered-text-area { width: 100%; position: relative; } .u0f03045539324c6a83cc9d541011a854 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u0f03045539324c6a83cc9d541011a854 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u0f03045539324c6a83cc9d541011a854 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u0f03045539324c6a83cc9d541011a854:hover .ctaButton { background-color: #E67E22!important; } .u0f03045539324c6a83cc9d541011a854 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u0f03045539324c6a83cc9d541011a854 .u0f03045539324c6a83cc9d541011a854-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u0f03045539324c6a83cc9d541011a854:after { content: ""; display: block; clear: both; } LEARN MORE? How To Install Gulp with Npm .u0f03045539324c6a83cc9d541011a854 , .u0f03045539324c6a83cc9d541011a854 .postImageUrl , .u0f03045539324c6a83cc9d541011a854 .centered-text-area { min-height: 80px; position: relative; } .u0f03045539324c6a83cc9d541011a854 , .u0f03045539324c6a83cc9d541011a854:hover , .u0f03045539324c6a83cc9d541011a854:visited , .u0f03045539324c6a83cc9d541011a854:active { border:0!important; } .u0f03045539324c6a83cc9d541011a854 .clearfix:after { content: ""; display: table; clear: both; } .u0f03045539324c6a83cc9d541011a854 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u0f03045539324c6a83cc9d541011a854:active , .u0f03045539324c6a83cc9d541011a854:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u0f03045539324c6a83cc9d541011a854 .centered-text-area { width: 100%; position: relative; } .u0f03045539324c6a83cc9d541011a854 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u0f03045539324c6a83cc9d541011a854 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u0f03045539324c6a83cc9d541011a854 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u0f03045539324c6a83cc9d541011a854:hover .ctaButton { background-color: #E67E22!important; } .u0f03045539324c6a83cc9d541011a854 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u0f03045539324c6a83cc9d541011a854 .u0f03045539324c6a83cc9d541011a854-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u0f03045539324c6a83cc9d541011a854:after { content: ""; display: block; clear: both; } 了解更多如何使用Npm安裝Gulp使用npm打印軟件包詳細信息 (Print Package Details with npm)
npm package information can be listed with the info or view command. We will also provide the package name. In this example, we will list and print information about the angular package.
可以使用info或view命令列出npm軟件包信息。 我們還將提供包裹名稱。 在此示例中,我們將列出并打印有關angular包的信息。
$ npm info angular Print Package Details with npm使用npm打印軟件包詳細信息Print Package Details with npm使用npm打印軟件包詳細信息We can see that the following information about the package is provided.
我們可以看到提供了有關該軟件包的以下信息。
name is the package full name.
name是程序包的全名。
description is short information about the package.
description是有關包裝的簡短信息。
latest is the latest version of the package.
latest是軟件包的最新版本。
readmeFilename is the name of the README.
readmeFilename是自述文件的名稱。
homepage is the official home page of the package.
homepage是程序包的官方主頁。
keywords is related tags and keywords with the package.
keywords是與程序包相關的標簽和關鍵字。
license is a usage license.
license是使用許可證。
翻譯自: https://www.poftut.com/npm-download-install-and-usage-tutorial/
npm下載安裝教程
總結
以上是生活随笔為你收集整理的npm下载安装教程_npm下载,安装和使用教程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [Leetcode][第647题][JA
- 下一篇: android 中文 api (72)