Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Portable Node.js and NPM on windows
  1. Get node binary (node.exe) from http://nodejs.org/download/
  2. Create the folder where node will reside and move node.exe to it
  3. Download the last zip version of npm from http://nodejs.org/dist/npm
  4. Unpack the zip inside the node folder
  5. Download the last tgz version of npm from http://nodejs.org/dist/npm
  6. Open the tgz file and unpack only the file bin/npm (without extension) directly on the node folder.
  7. Add the the node folder and the packages/bin folder to PATH
  8. On a command prompt execute npm install -g npm to update npm to the latest version

Now you can use npm and node from windows cmd or from bash shell like Git Bash of msysgit.

@gaurav21r

This comment has been minimized.

Copy link

commented Feb 16, 2016

npm packages are really old, we are at 3.0+ but site http://nodejs.org/dist/npm/ is only at 1.4.9

@vulpino

This comment has been minimized.

Copy link

commented Feb 19, 2016

For more up-to-date npm use https://registry.npmjs.org/npm/-/npm-{version}.tgz. Latest version as of this writing is 3.7.3 - so use https://registry.npmjs.org/npm/-/npm-3.7.3.tgz and use 7Zip or whatever to unzip it.

@rahilwazir

This comment has been minimized.

Copy link

commented Mar 13, 2016

This didn't worked for me, In case someone is looking for other solution:
https://codyswartz.us/wp/finds/node-js-stand-alone-portable-with-npm

@a-teammate

This comment has been minimized.

Copy link

commented May 23, 2016

This is only portable as long as you have git in your PATH

if you dont, take a look at this (really portable we assume) solution: https://github.com/inexor-game/platform/tree/master/bin/windows
(which needs an invocation like that: https://github.com/inexor-game/code/blob/master/tool/node_windows_generic_handler.bat )

@jorgeas80

This comment has been minimized.

Copy link

commented Sep 11, 2016

@s-h-a-d-o-w

This comment has been minimized.

Copy link

commented Oct 5, 2016

This is actually a great guide but the comments may unnecessarily confuse people looking at this.

a) It doesn't matter whether npm is out of date, that's why it says "npm install -g npm". As of npm 3.10.8, updating to that version straight from 1.4.9 works just fine.
b) You don't need any other guide or prepackaged thing.

The only thing I'd change about this guide is using something like the following command for updating npm instead:

npm install npm@latest

Because IMO, using the global flag is against the whole point of creating a portable node/npm "bundle".
(as for "npm@latest" - simply because it seems to be the officially recommended way of doing things)

Also note that setting the PATH is important for using this portable bundle, even if you create/copy it straight to the root of your project. I thought to myself "I can call everything straight from there - what could possibly happen?". But then one of the tools I used tried to launch a sub process in one of the sub directories. And of course, there, all the tools couldn't be found.

@NN---

This comment has been minimized.

Copy link

commented Dec 16, 2016

Download npm + nodejs in one zip https://nodejs.org/dist/v7.2.1/

@PabloEzequiel

This comment has been minimized.

Copy link

commented Jan 4, 2017

It works for me!

@GlassGruber

This comment has been minimized.

Copy link

commented Jan 7, 2017

  1. Download the last tgz version of npm from http://nodejs.org/dist/npm
  2. Open the tgz file and unpack only the file bin/npm (without extension) directly on the node folder.

Can you tell me why the above? Aren't the .zip and .tgz content exactly the same? As far as I can see they are.

@Audition-CSBlock

This comment has been minimized.

Copy link

commented Mar 8, 2018

Found a tutorial here: https://www.youtube.com/watch?v=N8cFnUruUEo (TimeStamps in description)

@CodeZeno

This comment has been minimized.

Copy link

commented May 15, 2018

In step 7 what packages/bin folder is being refered to? After following steps I have:

  • node_modules (folder)
  • node.exe (file)
  • npm (file)
  • npm.cmd (file)
@thdoan

This comment has been minimized.

Copy link

commented May 23, 2018

To improve portability, set the following (change path to wherever you installed it):

:: Set the location of globally installed npm modules
npm config set prefix /dev/nodejs --global

:: Set the location of the npm cache
npm config set cache /dev/nodejs/npm-cache --global

:: Uncomment if 'npm install' is not working for a module in Windows
::npm config set python /path/to/python/python.exe --global
::npm config set msvs_version 2010 --global
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.