install安装

Description描述
To publish and install packages to and from the public npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. 要在公共npm注册表中发布和安装包,必须使用Node版本管理器或Node安装程序安装Node.js和npm命令行接口。We strongly recommend using a Node version manager to install Node.js and npm.我们强烈建议使用Node版本管理器来安装Node.js和npm。 We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.我们不建议使用Node安装程序,因为Node安装过程将npm安装在具有本地权限的目录中,并且在全局运行npm包时可能会导致权限错误。

Overview概述
Checking your version of npm and Node.js检查您的npm和Node.js版本Using a Node version manager to install Node.js and npm使用Node版本管理器安装Node.js和npmUsing a Node installer to install Node.js and npm使用Node安装程序安装Node.js和npm

Checking your version of npm and Node.js检查您的npm和Node.js版本
To see if you already have Node.js and npm installed and check the installed version, run the following commands:要查看是否已经安装了Node.js和npm并检查安装的版本,请运行以下命令:
node -vnpm -v

Using a Node version manager to install Node.js and npm使用Node版本管理器安装Node.js和npm
Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions. 节点版本管理器允许您在系统上安装Node.js和npm的多个版本并在它们之间切换,这样您就可以在多个版本的npm上测试应用程序,以确保它们适用于不同版本的用户。You can search for them on GitHub.你可以在GitHub上搜索它们。

Using a Node installer to install Node.js and npm使用Node安装程序安装Node.js和npm
If you are unable to use a Node version manager, you can use a Node installer to install both Node.js and npm on your system.如果您无法使用Node版本管理器,可以使用Node安装程序在系统上安装Node.js和npm。
- Node.js
installer安装程序 NodeSource installer.NodeSource安装程序。If you use Linux, we recommend that you use a NodeSource installer.如果您使用Linux,我们建议您使用NodeSource安装程序。

OS X or Windows Node installersOS X或Windows节点安装程序
If you're using OS X or Windows, use one of the installers from the Node.js download page. 如果您使用的是OS X或Windows,请使用Node.js下载页面中的一个安装程序。Be sure to install the version labeled LTS. 请确保安装标记为LTS的版本。Other versions have not yet been tested with npm.其他版本尚未使用npm进行测试。

Linux or other operating systems Node installersLinux或其他操作系统节点安装程序
If you're using Linux or another operating system, use one of the following installers:如果您使用的是Linux或其他操作系统,请使用以下安装程序之一:
- NodeSource installer (recommended)
One of the installers on the Node.js download pageNode.js下载页面上的一个安装程序
Or see this page to install npm for Linux in the way many Linux developers prefer.或者,请参阅此页面,以许多Linux开发人员喜欢的方式为Linux安装npm。

Less-common operating systems不太常见的操作系统
For more information on installing Node.js on a variety of operating systems, see this page.有关在各种操作系统上安装Node.js的更多信息,请参阅本页。