Installing latest Node.js via NPM locally - misael-diaz/react-app-twitter GitHub Wiki

This wiki is based on this tutorial

Install Node's version manager locally:

npm install --save n

change directory to

cd node_modules/n/bin

and export the current path (/full/path/to/your/nodejs/project/node_modules/n/bin) so that the latest version of Node's version manager gets executed when you invoke it on the terminal:

export PATH="$PWD":"$PATH"

create a installation directory for the latest version of Node at the same level as the node_modules directory:

mkdir -p node/latest

change directory

cd node/latest

and export the N_PREFIX

export N_PREFIX="$PWD"

and install the latest version of Node by executing

n latest

to be able to invoke the latest version of Node from the terminal you need to update the PATH

cd node/latest/bin && export PATH="$PWD":"$PATH"

at the time of writing the latest version of node was

node --version
v19.8.1