Skip to content

Instantly share code, notes, and snippets.

@massahud
Last active January 19, 2025 20:43
Show Gist options
  • Save massahud/321a52f153e5d8f571be to your computer and use it in GitHub Desktop.
Save massahud/321a52f153e5d8f571be to your computer and use it in GitHub Desktop.
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.

@FahadBinHussain
Copy link

FahadBinHussain commented Oct 8, 2024

2024 updated guide created by me - https://rentry.co/node-portable

Thanks to @progmars

@jeanniton-mnr
Copy link

2024 updated guide created by me - https://rentry.co/node-portable

Thanks to @progmars

Thank you!

I was able to print the node version from the binary files you have provided

@selsie
Copy link

selsie commented Jan 18, 2025

It's even easier, if you just use:
npm config set prefix "D:\node\node_modules_new" for the downloaded modules (use your own path of course, but you need to make a new node_modules directory in besides the node_modules in the nodejs directory)
Then for the path in nodevars.bat:
set "PATH=%~dp0\node_modules_new\bin;%PATH%"

@tno2007
Copy link

tno2007 commented Jan 19, 2025

Video instructions

Link to NodeJS portable repo:
https://github.com/crazy-max/nodejs-portable

How.to.install.and.use.NodeJS.portable.on.Windows.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment