Nodejs version manager written in C++.
Feature:
-
Single exectable
-
Share global node modules
-
Uninstall Node.js installed by MSI installer and Remove
C:\Users\USERNAME\AppData\Roaming\npm
. -
mkdir somewhere-you-like
-
Add somewhere-you-like to
%PATH%
manually. -
Place
nodev.exe
in somewhere-you-like. -
Enjoy yourself.
> nodev use 12.16.2 > node -v > npm -v
-
Uninstall Node.js installed by system package manager.
-
mkdir -p ~/app/nodev
-
Add
~/app/nodev
and~/app/nodev/bin
to$PATH
.$ echo "export PATH=\$PATH:~/app/nodev:~/app/nodev/bin" >> ~/.bashrc $ source ~/.bashrc
-
Place
nodev
in~/app/nodev
. -
Enjoy yourself.
$ nodev use 12.16.2 $ node -v $ npm -v
-
Windows:
~\AppData\Roaming\nodev\Config\nodev.config.json
-
Linux:
~/.config/nodev/nodev.config.json
-
macOS:
~/Library/Preferences/nodev/nodev.config.json
-
type:
string
-
default:
.
The location where node is installed, can be a relative path to nodev executable.
Node.js executable path is ${prefix}\\node.exe
on Windows while ${prefix}/bin/node
on Linux / macOS.
See npm documentation.
-
type:
string
-
default:
https://nodejs.org/dist
-
type:
string
-
default:
- Windows:
~\AppData\Local\nodev\Cache\node
- Linux:
~/.cache/nodev/node
- macOS:
~/Library/Caches/nodev/node
- Windows:
Can be a relative path to nodev executable.
-
type:
'x64' | 'x86'
-
default:
x64
x86 is available on Windows only.
-
type:
string
-
default:
https://github.com/npm/cli/archive
-
type:
string
-
default:
- Windows:
~\AppData\Local\nodev\Cache\npm
- Linux:
~/.cache/nodev/npm
- macOS:
~/Library/Caches/nodev/npm
- Windows:
Can be a relative path to nodev executable.
{
"prefix": ".",
"node": {
"mirror": "https://npm.taobao.org/mirrors/node",
"cacheDir": "cache/node",
"arch": "x64"
},
"npm": {
"mirror": "https://npm.taobao.org/mirrors/npm",
"cacheDir": "cache/npm"
}
}
Getting source code.
$ git clone https://github.com/toyobayashi/nodev.git
$ cd ./nodev
$ git submodule init
$ git submodule update
Prerequests:
-
VC++ environment
-
CMake
Run Visual Studio x86 Native Tools Command Prompt.
Set VCVER variable.
14: VS 2015
15: VS 2017
16: VS 2019
> set VCVER=16
> scripts\buildzlib.bat
> scripts\buildcurl.bat
> build.bat win32 Release static
Output: dist\win\Win32\bin\nodev.exe
Prerequests:
-
gcc & g++
-
CMake
$ chmod +x ./scripts/buildzlib.sh ./build.sh
$ ./scripts/buildzlib.sh
$ ./scripts/build.sh Release
Output: ./dist/linux/bin/nodev-linux
Prerequests:
-
clang & clang++
-
CMake
$ chmod +x ./scripts/buildzlib.sh ./scripts/buildcurl.sh ./build.sh
$ ./scripts/buildzlib.sh
$ ./scripts/buildcurl.sh
$ ./scripts/build.sh Release
Output: ./dist/darwin/bin/nodev-darwin