安装npm(节点。在Windows (w/o使用节点)上。js MSI)

时间:2022-05-19 06:31:19

The problem: while using nvm to install Node.js I was able to install the version of Node.js I need, but nvm does not install npm automatically. NPM's page provides no information about installing it. Being not much of a Windows user myself I am completely at a loss...

问题:使用nvm安装节点。我可以安装Node版本。我需要,但是nvm不会自动安装npm。NPM的页面没有提供关于安装它的信息。我自己不是Windows用户,我完全不知所措……

Every result in Google seems to use Node.js MSI installer to get that working - which is not an option in my case. So, how do I?

谷歌中的每个结果似乎都使用Node。js MSI安装程序以使其工作—在我的情况下这不是一个选项。那么,我该如何?

11 个解决方案

#1


33  

To install npm on windows just unzip the npm archive where node is. See the docs for more detail.

要在windows上安装npm,只需解压node所在的npm归档文件。详情请参阅文档。

npm is shipped with node, that is how you should install it. nvm is only for changing node versions and does not install npm. A cleaner way to use npm and nvm is to first install node as it is (with npm), then install the nvm package by npm install nvm

npm与node一起发布,这是您应该安装它的方式。nvm只用于更改节点版本,不安装npm。使用npm和nvm的更干净的方法是首先安装节点(与npm一起),然后通过npm安装nvm来安装nvm包。

#2


20  

https://nodejs.org/download/ . The page has Windows Installer (.msi) as well as other installers and binaries.Download and install for windows.

https://nodejs.org/download/。该页面有Windows安装程序(.msi)以及其他安装程序和二进制文件。下载并安装windows。

Node.js comes with NPM.

节点。js NPM。

NPM is located in the directory where Node.js is installed.

NPM位于节点所在的目录中。js安装。

#3


11  

I used quite @Eyuel method:

我使用了@Eyuel方法:

  • Download the nodejs msi from https://nodejs.org/en/#download
  • 从https://nodejs.org/en/#下载中下载nodejs msi。
  • Download npm zip from github https://github.com/npm/npm
  • 下载npm zip从github https://github.com/npm/npm
  • Extract the msi (with 7 Zip) in a directory "node"
  • 在“节点”目录中提取msi(带7 Zip)
  • Set the PATH environment variable to add the "node" directory
  • 设置PATH环境变量以添加“node”目录
  • Extract the zip file from npm in a different directory (not under node directory)
  • 从npm的另一个目录(不在节点目录下)提取zip文件
  • CD to the npm directory and run the command node cli.js install npm -gf
  • CD到npm目录并运行命令节点cli。js安装npm的女朋友

Now you should have node + npm working, use theses commands to check: node --version and npm --version

现在应该让node + npm工作了,使用这些命令检查:node -version和npm -version

Update 27/07/2017 : I noticed that the latest version of node 8.2.1 with the latest version of npm are quite different from the one I was using at the time of this answer. The install with theses versions won't work. It is working with node 6.11.1 and npm 5.2.3. Also if you are running with a proxy don't forget this to connect on internet :

更新27/07/2017:我注意到最新版本的npm版本8.2.1与我在回答这个问题时使用的版本有很大的不同。安装这些版本将不起作用。它与节点6.11.1和npm 5.2.3一起工作。另外,如果你正在运行一个代理,不要忘记这个在互联网上连接:

#4


8  

First CD to where node(nodejs) is installed using windows CMD, then follow the steps below

第一个CD到node(node . js)是使用windows CMD安装的,然后执行下面的步骤。

C:...\node> git config --system http.sslcainfo /bin/curl-ca-bundle.crt
C:...\node> git clone --recursive git://github.com/isaacs/npm.git
C:...\node> cd node=modules\npm
C:...\node=modules\npm> node cli.js install npm -gf

#5


8  

I also needed to install npm in Windows and got it through the Chocolatey pacakage manager. For those who haven't heard about it, Chocolatey is a package manager for Windows, that gives you the convenience of an apt-get in Windows environments. To get it go to https://chocolatey.org/ where there's a PowerShell script to download it and install it. After that you can run:

我还需要在Windows中安装npm,并通过Chocolatey pacakage manager获得它。对于那些没有听说过它的人来说,Chocolatey是Windows的一个包管理器,它提供了在Windows环境中使用apt-get的便利。要获取它,请访问https://chocolatey.org/,那里有PowerShell脚本下载并安装它。在那之后你可以跑:

chocolatey install npm

and you're good to go.

你可以走了。

Note that the standalone npm is no longer being updated and the last version that is out there is known to have problems on Windows. Another option you can look at is extracting npm from the MSI using LessMSI.

请注意,独立的npm不再被更新,而已知的最后一个版本在Windows上有问题。您可以查看的另一个选项是使用LessMSI从MSI提取npm。

#6


7  

Just download "node.exe" from http://nodejs.org/dist/, select your favorite "node.js" version or take the latest. You can also take 64-bits version from "x64" sub-directory.

只是下载”节点。exe“从http://nodejs.org/dist/中选择您最喜欢的”节点。下载最新版本。您还可以从“x64”子目录获取64位版本。

Then, go to http://nodejs.org/dist/npm/ to retrieve Zip-archive of your favorite "npm" version (recommanded : 1.4.10). Extract the archive along "node.exe".

然后,转到http://nodejs.org/dist/npm/获取您最喜欢的“npm”版本的Zip-archive(重命令:1.4.10)。按照“node.exe”提取归档文件。

Finally, it is recommanded to add "node.js" directory to the PATH for convenience.

最后,重新命令添加“node”。目录到路径的方便。

EDIT: I recommande to update npm using npm install npm -g because versions provided by nodejs.org are very old.

编辑:我命令使用npm安装npm -g更新npm,因为nodejs.org提供的版本非常古老。

If you want to keep original npm version, don't put npm alongside "node.exe". Just create a directory and use the same command with "global" flag, then copy .\node_modules\.bin\npm.cmd to the new directory :

如果你想保留原始的npm版本,不要把npm放在“node.exe”旁边。创建一个目录并使用“全局”标志的相同命令,然后复制。\node_modules\.bin\npm。cmd到新目录:

mkdir c:\app\npm\_latest
cd c:\app\npm\_latest
<NPM_ORIGINAL_PATH>\npm install npm
cp node_modules\.bin\npm.cmd npm.cmd

Finally change your PATH to use c:\app\npm\_latest

最后改变你的路径使用c:\app\npm\_latest

#7


2  

I wrote a quick simple app recent that handle the management of various version of node and npm. It allows you to choose different version of node and npm to download and select which version to use. Check it out and see if it's something that's useful.

我最近写了一个简单的应用,处理各种版本的node和npm的管理。它允许您选择不同版本的node和npm来下载和选择使用哪个版本。看看它是不是有用的东西。

https://github.com/nhatkthanh/wnm

https://github.com/nhatkthanh/wnm

#8


1  

Try going to Window -> Preferences -> Nodeclipse and unchecking the box that says "find node on PATH...". Then make sure the "Node.js path" below is set to the location of the node.exe file (for me it was C:\Program Files (x86)\nodejs\node.exe).

尝试打开窗口->首选项-> Nodeclipse,取消选中“查找路径上的节点…”的框。然后确定“节点”。下面的js路径被设置为节点的位置。exe文件(对我来说,这是C:\Program Files (x86)\nodejs\ node.exe)。

#9


0  

Download the latest Node.js MSI (4.x or 5.x) installer and run the following via command line:

下载最新的节点。js MSI(4。x或5.x)安装程序,并通过命令行运行以下命令:

msiexec /a node-v4.4.3-x64.msi /qb TARGETDIR="C:\Node.js"

This will extract the binaries into C:\Node.js\nodejs.

这将把二进制文件提取到C:\Node.js\ Node.js中。

Then you will want to add C:\Node.js\nodejs PATH environment variable.

然后需要添加C:\节点。js \ nodejs PATH环境变量。

To update NPM, do the following:

要更新NPM,请执行以下操作:

cd C:\Node.js\nodejs
npm install npm@latest

After that completes, you should be able to check the versions:

完成后,您应该能够检查版本:

node --version
npm --version

Node should be 4.4.3+ (whichever you installed) and npm should be 3.8.7+.

节点应该是4.4.3+(无论你安装了什么),npm应该是3.8.7+。

#10


0  

"Chocolatey installs in seconds"

If you don't care about sarcasm or lamenting engineers on a Sunday afternoon, skip ahead to the installation instructions in the TL;DR section below.

如果你不关心周日下午的讽刺或工程师的抱怨,请跳过以下TL;DR部分的安装说明。

For everyone else: I want to amend this answer which recommends using (what seems to be the hottest package management solution for Windows right now): Chocolatey

对于其他人:我想修改这个建议使用的答案(目前Windows最热门的软件包管理解决方案):Chocolatey

It gets the job done nice and quick. However, when I gave it a first try, it took me a while to make sense of the install instructions which are kinda convoluted. The install instructions go a bit like this (complete with what went through my head while going through it):

它能很快地完成工作。然而,当我第一次尝试它时,我花了一些时间来理解有点复杂的安装指令。安装说明有点像这样(完成时,我的头脑通过它):

  • NOTE:
  • 注意:
  • NOTE:
  • 注意:
  • NOTE:

    three big-ass NOTEs before even knowing the basics... this makes me anxious... how wrong could things go!?

    在你还不知道这些基本的东西之前,就已经有了三张很棒的笔记……这让我焦虑……事情会有多糟!

  • Installing With Restricted TLS

    not even sure what TLS is... Oh it's a good friend of SSL - Shouldn't this just be the default and just work out of the box? My browser can do HTTPS, NO PROBLEM! (just kidding... I know that SSL and TSL frequently cause a lot of pain in environments that have high security needs)

    甚至不确定TLS是什么……哦,它是SSL的好朋友——难道这不是默认的吗?我的浏览器可以使用HTTPS,没问题!(只是开玩笑…我知道SSL和TSL经常会在高安全性需求的环境中造成很大的痛苦。

  • Option 1
  • 选项1
  • Option 2

    eeh... great... Can't I just install?

    eeh……伟大的……我不能安装?

  • Installing Behind a Proxy?

    Just... no...

    只是…不…

  • Requirements

    uh boi...

    哦男孩……

  • Why does Chocolatey install where it does by default?

    Seriously!?!

    严重! ? !

  • Before You Install

    sad http://www.clipartbest.com/cliparts/jix/Ekx/jixEkxaGT.png

    悲伤的http://www.clipartbest.com/cliparts/jix/Ekx/jixEkxaGT.png

  • Can I install with a proxy?

    again with the proxy...

    再与代理…

  • Can I install a particular version of Chocolatey?

    just any version would be fine, thank you...

    任何版本都可以,谢谢。

  • Can I use Windows built-in compression instead of downloading 7zip?

    7zip?! Why do you even mention this?!

    7 zip ? !你为什么要提这个?!

  • Non-Administrative Install
  • 非管理员安装
  • Now that sounds great!

    这听起来不错!

    • "NOTE: This option should be a last resort and is considered to be an advanced scenario."
      • Sh$%!@T.

        Sh $ % ! @T。

  • Alternative Installation Options

    giddy

    头晕

  • Command Line
    • "This really is the easiest method because it requires no configuration of PowerShell prior to executing it."

      And there you go!

      你走吧!

While I really appreciate the fact that pitfalls and their possible solutions are discussed so extensively, maybe re-organizing them as such, and putting the Chocolatey installs in seconds promise to work by putting the "easiest method" first would be just awesome!

虽然我真的很欣赏这个事实,陷阱和它们可能的解决方案被广泛讨论,也许重新组织它们,把巧克力装在几秒钟内就能实现,把“最简单的方法”放在第一位,这将是非常棒的!

TL;DR: Install Chocolatey, Node (and NPM)

Install Chocolatey

NOTE: You might want to copy the exact command from their install page since it might change over time.

注意:您可能想要从他们的安装页面中复制确切的命令,因为它可能随时间而改变。

  1. Open your standard Windows command line
  2. 打开标准的Windows命令行
  3. @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  4. @powershell -NoProfile -ExecutionPolicy unrestricted -Command (iex (new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1') >$null 2>&1" & SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey bin"
  5. Restart console
  6. 启动控制台
  7. Done!
  8. 完成了!

Install Node (and NPM)

  1. Because Chocolatey installs a directory different from the MSI installation, go to your system configuration and delete your previous node installation (if you have one)
  2. 由于Chocolatey安装与MSI安装不同的目录,请转到系统配置并删除先前的节点安装(如果有的话)
  3. Install Chocolatey as described above
  4. 如上所述安装Chocolatey
  5. choco install nodejs

    NOTE I used nodejs. I am not even sure what node is, but having had my fair share of troubles with node already being taken by something else in other systems, I thought, nodejs would be the safer bet right away

    请注意我用nodejs。我甚至不确定节点是什么,但是我也有一些问题,我的节点已经被其他系统的其他东西占用了,我想nodejs会是最安全的选择

  6. Restart your console
  7. 重新启动您的控制台
  8. Beware: node -v works!
    • And npm -v also works! Awesome.
    • npm -v也可以!太棒了。
  9. 注意:节点- v工作!npm -v也可以!太棒了。

After this, I was able to install firebase-tools without problems (which I was not able to do previously), so something must have gone terribly right! :)

在此之后,我可以毫无问题地安装firebase-tools(我以前不能这样做),所以有些东西一定非常正确!:)

#11


0  

If you're running Windows 10 Creators Update (1703) and are comfortable navigating around a Unix terminal, you could potentially achieve this using the native Feature Bash on Ubuntu on Windows (aka Bash/WSL)

如果您正在运行Windows 10 creator Update(1703),并且能够在Unix终端上轻松导航,那么您可以使用Windows上Ubuntu的本机特性Bash(即Bash/WSL)实现这一点。

This was originally introduced on the launch of Build 2016 but many additions and bug fixes were addressed at the Creators update but please be warned this is still in Beta.

这最初是在Build 2016的发布中引入的,但是在创建者更新中增加了许多添加和错误修复,但是请注意,这仍然是测试版。

To enable simply navigate to Control Panel\All Control Panel Items\Programs and Features\Turn Windows features on or off

要启用简单导航以控制面板\所有的控制面板项目\程序和功能\打开或关闭Windows功能

Then select the Windows Subsystem for Linux (Beta) as below Bash on Windows Feature

然后在Windows特性上选择Linux (Beta)的Windows子系统。

#1


33  

To install npm on windows just unzip the npm archive where node is. See the docs for more detail.

要在windows上安装npm,只需解压node所在的npm归档文件。详情请参阅文档。

npm is shipped with node, that is how you should install it. nvm is only for changing node versions and does not install npm. A cleaner way to use npm and nvm is to first install node as it is (with npm), then install the nvm package by npm install nvm

npm与node一起发布,这是您应该安装它的方式。nvm只用于更改节点版本,不安装npm。使用npm和nvm的更干净的方法是首先安装节点(与npm一起),然后通过npm安装nvm来安装nvm包。

#2


20  

https://nodejs.org/download/ . The page has Windows Installer (.msi) as well as other installers and binaries.Download and install for windows.

https://nodejs.org/download/。该页面有Windows安装程序(.msi)以及其他安装程序和二进制文件。下载并安装windows。

Node.js comes with NPM.

节点。js NPM。

NPM is located in the directory where Node.js is installed.

NPM位于节点所在的目录中。js安装。

#3


11  

I used quite @Eyuel method:

我使用了@Eyuel方法:

  • Download the nodejs msi from https://nodejs.org/en/#download
  • 从https://nodejs.org/en/#下载中下载nodejs msi。
  • Download npm zip from github https://github.com/npm/npm
  • 下载npm zip从github https://github.com/npm/npm
  • Extract the msi (with 7 Zip) in a directory "node"
  • 在“节点”目录中提取msi(带7 Zip)
  • Set the PATH environment variable to add the "node" directory
  • 设置PATH环境变量以添加“node”目录
  • Extract the zip file from npm in a different directory (not under node directory)
  • 从npm的另一个目录(不在节点目录下)提取zip文件
  • CD to the npm directory and run the command node cli.js install npm -gf
  • CD到npm目录并运行命令节点cli。js安装npm的女朋友

Now you should have node + npm working, use theses commands to check: node --version and npm --version

现在应该让node + npm工作了,使用这些命令检查:node -version和npm -version

Update 27/07/2017 : I noticed that the latest version of node 8.2.1 with the latest version of npm are quite different from the one I was using at the time of this answer. The install with theses versions won't work. It is working with node 6.11.1 and npm 5.2.3. Also if you are running with a proxy don't forget this to connect on internet :

更新27/07/2017:我注意到最新版本的npm版本8.2.1与我在回答这个问题时使用的版本有很大的不同。安装这些版本将不起作用。它与节点6.11.1和npm 5.2.3一起工作。另外,如果你正在运行一个代理,不要忘记这个在互联网上连接:

#4


8  

First CD to where node(nodejs) is installed using windows CMD, then follow the steps below

第一个CD到node(node . js)是使用windows CMD安装的,然后执行下面的步骤。

C:...\node> git config --system http.sslcainfo /bin/curl-ca-bundle.crt
C:...\node> git clone --recursive git://github.com/isaacs/npm.git
C:...\node> cd node=modules\npm
C:...\node=modules\npm> node cli.js install npm -gf

#5


8  

I also needed to install npm in Windows and got it through the Chocolatey pacakage manager. For those who haven't heard about it, Chocolatey is a package manager for Windows, that gives you the convenience of an apt-get in Windows environments. To get it go to https://chocolatey.org/ where there's a PowerShell script to download it and install it. After that you can run:

我还需要在Windows中安装npm,并通过Chocolatey pacakage manager获得它。对于那些没有听说过它的人来说,Chocolatey是Windows的一个包管理器,它提供了在Windows环境中使用apt-get的便利。要获取它,请访问https://chocolatey.org/,那里有PowerShell脚本下载并安装它。在那之后你可以跑:

chocolatey install npm

and you're good to go.

你可以走了。

Note that the standalone npm is no longer being updated and the last version that is out there is known to have problems on Windows. Another option you can look at is extracting npm from the MSI using LessMSI.

请注意,独立的npm不再被更新,而已知的最后一个版本在Windows上有问题。您可以查看的另一个选项是使用LessMSI从MSI提取npm。

#6


7  

Just download "node.exe" from http://nodejs.org/dist/, select your favorite "node.js" version or take the latest. You can also take 64-bits version from "x64" sub-directory.

只是下载”节点。exe“从http://nodejs.org/dist/中选择您最喜欢的”节点。下载最新版本。您还可以从“x64”子目录获取64位版本。

Then, go to http://nodejs.org/dist/npm/ to retrieve Zip-archive of your favorite "npm" version (recommanded : 1.4.10). Extract the archive along "node.exe".

然后,转到http://nodejs.org/dist/npm/获取您最喜欢的“npm”版本的Zip-archive(重命令:1.4.10)。按照“node.exe”提取归档文件。

Finally, it is recommanded to add "node.js" directory to the PATH for convenience.

最后,重新命令添加“node”。目录到路径的方便。

EDIT: I recommande to update npm using npm install npm -g because versions provided by nodejs.org are very old.

编辑:我命令使用npm安装npm -g更新npm,因为nodejs.org提供的版本非常古老。

If you want to keep original npm version, don't put npm alongside "node.exe". Just create a directory and use the same command with "global" flag, then copy .\node_modules\.bin\npm.cmd to the new directory :

如果你想保留原始的npm版本,不要把npm放在“node.exe”旁边。创建一个目录并使用“全局”标志的相同命令,然后复制。\node_modules\.bin\npm。cmd到新目录:

mkdir c:\app\npm\_latest
cd c:\app\npm\_latest
<NPM_ORIGINAL_PATH>\npm install npm
cp node_modules\.bin\npm.cmd npm.cmd

Finally change your PATH to use c:\app\npm\_latest

最后改变你的路径使用c:\app\npm\_latest

#7


2  

I wrote a quick simple app recent that handle the management of various version of node and npm. It allows you to choose different version of node and npm to download and select which version to use. Check it out and see if it's something that's useful.

我最近写了一个简单的应用,处理各种版本的node和npm的管理。它允许您选择不同版本的node和npm来下载和选择使用哪个版本。看看它是不是有用的东西。

https://github.com/nhatkthanh/wnm

https://github.com/nhatkthanh/wnm

#8


1  

Try going to Window -> Preferences -> Nodeclipse and unchecking the box that says "find node on PATH...". Then make sure the "Node.js path" below is set to the location of the node.exe file (for me it was C:\Program Files (x86)\nodejs\node.exe).

尝试打开窗口->首选项-> Nodeclipse,取消选中“查找路径上的节点…”的框。然后确定“节点”。下面的js路径被设置为节点的位置。exe文件(对我来说,这是C:\Program Files (x86)\nodejs\ node.exe)。

#9


0  

Download the latest Node.js MSI (4.x or 5.x) installer and run the following via command line:

下载最新的节点。js MSI(4。x或5.x)安装程序,并通过命令行运行以下命令:

msiexec /a node-v4.4.3-x64.msi /qb TARGETDIR="C:\Node.js"

This will extract the binaries into C:\Node.js\nodejs.

这将把二进制文件提取到C:\Node.js\ Node.js中。

Then you will want to add C:\Node.js\nodejs PATH environment variable.

然后需要添加C:\节点。js \ nodejs PATH环境变量。

To update NPM, do the following:

要更新NPM,请执行以下操作:

cd C:\Node.js\nodejs
npm install npm@latest

After that completes, you should be able to check the versions:

完成后,您应该能够检查版本:

node --version
npm --version

Node should be 4.4.3+ (whichever you installed) and npm should be 3.8.7+.

节点应该是4.4.3+(无论你安装了什么),npm应该是3.8.7+。

#10


0  

"Chocolatey installs in seconds"

If you don't care about sarcasm or lamenting engineers on a Sunday afternoon, skip ahead to the installation instructions in the TL;DR section below.

如果你不关心周日下午的讽刺或工程师的抱怨,请跳过以下TL;DR部分的安装说明。

For everyone else: I want to amend this answer which recommends using (what seems to be the hottest package management solution for Windows right now): Chocolatey

对于其他人:我想修改这个建议使用的答案(目前Windows最热门的软件包管理解决方案):Chocolatey

It gets the job done nice and quick. However, when I gave it a first try, it took me a while to make sense of the install instructions which are kinda convoluted. The install instructions go a bit like this (complete with what went through my head while going through it):

它能很快地完成工作。然而,当我第一次尝试它时,我花了一些时间来理解有点复杂的安装指令。安装说明有点像这样(完成时,我的头脑通过它):

  • NOTE:
  • 注意:
  • NOTE:
  • 注意:
  • NOTE:

    three big-ass NOTEs before even knowing the basics... this makes me anxious... how wrong could things go!?

    在你还不知道这些基本的东西之前,就已经有了三张很棒的笔记……这让我焦虑……事情会有多糟!

  • Installing With Restricted TLS

    not even sure what TLS is... Oh it's a good friend of SSL - Shouldn't this just be the default and just work out of the box? My browser can do HTTPS, NO PROBLEM! (just kidding... I know that SSL and TSL frequently cause a lot of pain in environments that have high security needs)

    甚至不确定TLS是什么……哦,它是SSL的好朋友——难道这不是默认的吗?我的浏览器可以使用HTTPS,没问题!(只是开玩笑…我知道SSL和TSL经常会在高安全性需求的环境中造成很大的痛苦。

  • Option 1
  • 选项1
  • Option 2

    eeh... great... Can't I just install?

    eeh……伟大的……我不能安装?

  • Installing Behind a Proxy?

    Just... no...

    只是…不…

  • Requirements

    uh boi...

    哦男孩……

  • Why does Chocolatey install where it does by default?

    Seriously!?!

    严重! ? !

  • Before You Install

    sad http://www.clipartbest.com/cliparts/jix/Ekx/jixEkxaGT.png

    悲伤的http://www.clipartbest.com/cliparts/jix/Ekx/jixEkxaGT.png

  • Can I install with a proxy?

    again with the proxy...

    再与代理…

  • Can I install a particular version of Chocolatey?

    just any version would be fine, thank you...

    任何版本都可以,谢谢。

  • Can I use Windows built-in compression instead of downloading 7zip?

    7zip?! Why do you even mention this?!

    7 zip ? !你为什么要提这个?!

  • Non-Administrative Install
  • 非管理员安装
  • Now that sounds great!

    这听起来不错!

    • "NOTE: This option should be a last resort and is considered to be an advanced scenario."
      • Sh$%!@T.

        Sh $ % ! @T。

  • Alternative Installation Options

    giddy

    头晕

  • Command Line
    • "This really is the easiest method because it requires no configuration of PowerShell prior to executing it."

      And there you go!

      你走吧!

While I really appreciate the fact that pitfalls and their possible solutions are discussed so extensively, maybe re-organizing them as such, and putting the Chocolatey installs in seconds promise to work by putting the "easiest method" first would be just awesome!

虽然我真的很欣赏这个事实,陷阱和它们可能的解决方案被广泛讨论,也许重新组织它们,把巧克力装在几秒钟内就能实现,把“最简单的方法”放在第一位,这将是非常棒的!

TL;DR: Install Chocolatey, Node (and NPM)

Install Chocolatey

NOTE: You might want to copy the exact command from their install page since it might change over time.

注意:您可能想要从他们的安装页面中复制确切的命令,因为它可能随时间而改变。

  1. Open your standard Windows command line
  2. 打开标准的Windows命令行
  3. @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  4. @powershell -NoProfile -ExecutionPolicy unrestricted -Command (iex (new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1') >$null 2>&1" & SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey bin"
  5. Restart console
  6. 启动控制台
  7. Done!
  8. 完成了!

Install Node (and NPM)

  1. Because Chocolatey installs a directory different from the MSI installation, go to your system configuration and delete your previous node installation (if you have one)
  2. 由于Chocolatey安装与MSI安装不同的目录,请转到系统配置并删除先前的节点安装(如果有的话)
  3. Install Chocolatey as described above
  4. 如上所述安装Chocolatey
  5. choco install nodejs

    NOTE I used nodejs. I am not even sure what node is, but having had my fair share of troubles with node already being taken by something else in other systems, I thought, nodejs would be the safer bet right away

    请注意我用nodejs。我甚至不确定节点是什么,但是我也有一些问题,我的节点已经被其他系统的其他东西占用了,我想nodejs会是最安全的选择

  6. Restart your console
  7. 重新启动您的控制台
  8. Beware: node -v works!
    • And npm -v also works! Awesome.
    • npm -v也可以!太棒了。
  9. 注意:节点- v工作!npm -v也可以!太棒了。

After this, I was able to install firebase-tools without problems (which I was not able to do previously), so something must have gone terribly right! :)

在此之后,我可以毫无问题地安装firebase-tools(我以前不能这样做),所以有些东西一定非常正确!:)

#11


0  

If you're running Windows 10 Creators Update (1703) and are comfortable navigating around a Unix terminal, you could potentially achieve this using the native Feature Bash on Ubuntu on Windows (aka Bash/WSL)

如果您正在运行Windows 10 creator Update(1703),并且能够在Unix终端上轻松导航,那么您可以使用Windows上Ubuntu的本机特性Bash(即Bash/WSL)实现这一点。

This was originally introduced on the launch of Build 2016 but many additions and bug fixes were addressed at the Creators update but please be warned this is still in Beta.

这最初是在Build 2016的发布中引入的,但是在创建者更新中增加了许多添加和错误修复,但是请注意,这仍然是测试版。

To enable simply navigate to Control Panel\All Control Panel Items\Programs and Features\Turn Windows features on or off

要启用简单导航以控制面板\所有的控制面板项目\程序和功能\打开或关闭Windows功能

Then select the Windows Subsystem for Linux (Beta) as below Bash on Windows Feature

然后在Windows特性上选择Linux (Beta)的Windows子系统。