Featured image of post [Archived] Creating a Portable NodeJS (Fits in a USB Drive)

[Archived] Creating a Portable NodeJS (Fits in a USB Drive)

Exploring NodeJS: A Standalone Development Environment in a USB Drive

Note

This article has been migrated from the old blog system. Formatting and external resources may be broken, and please note the content’s timeliness.

Main Content

Exploring NodeJS: A Standalone Development Environment in a USB Drive

Create a BAT script in the directory where you want to set up the portable NodeJS environment and input the following content:

(Remember to change the file extension when saving.)

1
2
3
4
5
6
7
8
@echo off
title NodeJS Shell
set NODE_HOME=%~dp0
set NODE_PATH=%~dp0
set PATH=%~dp0;%NODE_HOME%;%NODE_PATH%;%PATH%;
cd /d %~dp0
cmd.exe
pause

After saving the script, download the latest version of NodeJS from the Official NodeJS Website, making sure to select the ZIP format.

Note: Choose Other Downloads;

NodeJS Download Page

Download the ZIP package according to your system architecture (32-bit or 64-bit).

NodeJS Download Page

After downloading, extract the files and ensure node.exe from the ZIP is in the same directory as the BAT script you created earlier.

NodeJS Compressed File

Run the BAT script you wrote earlier to enter the portable NodeJS environment.

In this environment, installing/uninstalling packages with NPM will not affect the existing NodeJS installation on your system.

Storing it in a USB drive allows you to carry a portable development environment with you—very convenient!

Built with Hugo
Theme Stack designed by Jimmy