Portable NodeJS without administrator access
Tags: javascript, node, windows, portable
Published: 2020-02-18 12:51:51

So you want to use NodeJS on a portable flash drive?
Or maybe just in a non-restricted directory? 

If you are reading this then you may have gone through the following as I have.

1. Attempted to use [NodeJS Portable by Crazy Max](https://github.com/crazy-max/nodejs-portable/) which fails due to the company proxy server and not being able to set the proxy before the installation of Node.

2. Attempted to use [NodeJS Portable by Gareth Flowers](https://github.com/garethflowers/nodejs-portable) which installs correctly but the Node version is too outdated to use ReactJS or similar frameworks.

3.  Attempted to use [nvm-windows](https://github.com/coreybutler/nvm-windows/) which after following the instructions given in the [README](https://github.com/coreybutler/nvm-windows/blob/master/README.md) doesn't work because `nvm use 13.8.0` requires you to enter a username and password for Window's User Account Control.

If you are still reading then here is my working (very hacky) solution to get NodeJS portable! 

I used a portable version of [Cmder](https://cmder.net/) but I imagine any terminal program where you can add to the PATH is fine.

1. Install [Cmder](https://cmder.net/) in your desired location.
2. Download `nvm-noinstall.zip` from the [latest release](https://github.com/coreybutler/nvm-windows/releases/latest).
3. Extract the contents of `nvm-noinstall.zip` into the `bin` folder inside of the portable Cmder folder.
4. Navigate to the `bin` folder in Cmder and run `install.md`
5. When asked to enter the absolute path use your Cmder `bin` folder. (In my case, for some reason the `settings.txt`  isn't created in the `bin` folder but instead is made at root of my usb i.e. `E:/` ).
6. Install the version of node you want i.e. `nvm install latest` (Make sure to still be inside of the `bin` folder in your terminal program).
7. Wait until `node` and `npm` have finished installing.
8. Inside the `bin` folder there should be a folder containing the latest node version e.g. `v13.8.0`.
9. Copy the absolute path to that folder. e.g. `E:\PortableApps\CmderPortable\bin\v13.8.0`.
10. Add this to your existing path in Cmder's environment settings. e.g. `set "PATH=E:\PortableApps\CmderPortable\bin\v13.8.0;%PATH%"`
11. Make sure you are still inside your `bin` folder. Run `nvm use v13.8.0` or your chosen node version. You can close the username and password window both times without entering anything. It should tell you `Now using node v13.8.0 (64-bit)`.
12. Close and open Cmder and you should have access to `node`, `npm` and `npx` 😄.

I have also posted this information on the [nvm-windows](https://github.com/coreybutler/nvm-windows) issue requesting for a portable version [#363](https://github.com/coreybutler/nvm-windows/issues/363)

Let me know if you have any alternative solutions. I would be happy to read them in the comments. 

Happy coding! 🥳

P.S. I'd like to start the habit of sharing the music that I am listening to while writing up my posts. Today's music is a part of a set by South African super collector [DJ Okapi](https://soundcloud.com/afrosynth). Check it out here. [https://www.mixcloud.com/radioradioradioradio/dj-okapi-radio-radio/](https://www.mixcloud.com/radioradioradioradio/dj-okapi-radio-radio/)