Portable version of NodeJS on Windows

(This is a corrected version of this blog post)

  1. Install Cmder in your desired location.
  2. Download nvm-noinstall.zip from the latest release.
  3. Extract the contents of nvm-noinstall.zip (i.e.: nvm.exe …) into the bin folder inside of the portable Cmder folder.
  4. Navigate to the bin.
  5. Create a new file called install_fix.cmd that contains this code.
  6. Open a terminal in the bin folder and type .\install_fix.cmd
  7. When asked to enter the path use the full path to your Cmder bin folder.
  8. If it worked, a file called settings.txt has been created in the your Cmder bin folder.
  9. Close the terminal, and reopen it in the bin folder.
  10. Install the version of Node you want, e.g. nvm install latest.
  11. Wait until the installation is completed, then, inside the bin folder, there should be a new folder containing the latest Node version (e.g. v17.3.0).

From there, you can use the full path to your Cmder bin + the Node version folder + node.exe to execute something with this version of Node using Powershell, CMD or other terminal.

For example:

PS D:\experiments\my-stuff\> D:\experiments\nodejs-portable\cmder_mini\bin\v17.3.0\node.exe index.js

You could use Cmder with the Node path in the Startup Settings of the app; e.g. set "PATH=D:\experiments\nodejs-portable\cmder_mini\bin\v17.3.0;%PATH%". This way, in Cmder, when typing node.exe it’s the portable version that will be used.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*