Skip to content

Instantly share code, notes, and snippets.

@massahud
Last active November 7, 2024 12:45
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.

@jeanniton-mnr
Copy link

It's 2023 - save yourself some time...

Download and run: https://github.com/crazy-max/nodejs-portable/releases/download/2.10.0/nodejs-portable.exe

Node.js Portable 2.10.0
https://github.com/crazy-max/nodejs-portable

# Menu
 1 - Install
 2 - Shell

* Type 'exit' to leave Node.js Portable

'menu' for help>
  • Press [1] and [Enter]
  • Press [Enter] (or first enter Node version you want)
  • Press [Enter] (or 'x64' for 64bit version)
  Version (default 19.4.0):
  Architecture (default x86):

Checking Node.js version 19.4.0... OK!
Downloading https://nodejs.org/dist/v19.4.0/node-v19.4.0-win-x86.zip................... OK!
Extracting node-v19.4.0-win-x86.zip... OK!
Moving nodejs folder... OK!
Creating Node.js configuration... OK!


'menu' for help>
  • Type menu and [Enter]
  • Type [2] and [Enter]
  • Type [Enter]
'menu' for help> menu

# Menu
 1 - Install
 2 - Shell

* Type 'exit' to leave Node.js Portable

'menu' for help> 2

Checking if Node.js installed... OK!
Creating Node.js configuration... OK!
Checking custom paths...
# C:\Program Files (x86)\Git\cmd Warning: Not found...
# D:\another_path Warning: Not found...
# C:\apps\a_relative_path Warning: Not found...
Adding node to PATH... OK!
Setting NODE_PATH... OK!
Creating launch script... OK!

Press Enter to open the shell...

You're done!

node -v

npm -v

What your speedrun time?!

Your solution has worked for me.

Thank you!

@FahadBinHussain
Copy link

FahadBinHussain commented Oct 8, 2024

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

Thanks to @progmars

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