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...
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?
"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.
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
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):
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.
@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"
Install Node (and NPM)
node
installation (if you have one)choco install nodejs
node -v
works!npm -v
also works! Awesome.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! :)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:
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.
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).
I used quite @Eyuel method:
node cli.js install npm -gf
Now you should have node + npm working, use theses commands to check:
node --version
andnpm --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 :
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.
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".Finally, it is recommanded to add "node.js" directory to the PATH for convenience.
EDIT: I recommande to update npm using
npm install npm -g
because versions provided by nodejs.org are very old.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 :Finally change your PATH to use
c:\app\npm\_latest
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)
To enable simply navigate to Control Panel\All Control Panel Items\Programs and Features\Turn Windows features on or off
Then select the Windows Subsystem for Linux (Beta) as below Bash on Windows Feature