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
auto
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.
https://github.com/nhatkthanh/wnm
First CD to where node(nodejs) is installed using windows CMD, then follow the steps below
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
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)
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.
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
To install npm on windows just unzip the npm archive where node is. See the docs for more detail.
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
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"
node
installation (if you have one)choco install nodejs
NOTE I used
nodejs
. I am not even sure whatnode
is, but having had my fair share of troubles withnode
already being taken by something else in other systems, I thought,nodejs
would be the safer bet right away
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! :)
"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):
three big-ass NOTEs before even knowing the basics... this makes me anxious... how wrong could things go!?
not even sure what
TLS
is... Oh it's a good friend ofSSL
- Shouldn't this just be the default and just work out of the box? My browser can doHTTPS
, NO PROBLEM! (just kidding... I know thatSSL
andTSL
frequently cause a lot of pain in environments that have high security needs)
eeh... great... Can't I just install?
Just... no...
uh boi...
Seriously!?!
Before You Install
(source: clipartbest.com)
Can I install with a proxy?
again with the proxy...
just any version would be fine, thank you...
7zip?! Why do you even mention this?!
Now that sounds great!
Sh$%!@T.
giddy
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!