Node.js official download page: https://nodejs.org/en/download/
I chose the stable version, and the download address is:https://nodejs.org/dist/v18.14.0/node-v18.14.0.tar.gz a>
Generally, the installation directory of third-party software on Linux is /usr/local.
Download source code
(Be sure to replace the download address yourself)
wget https://nodejs.org/dist/v18.14.0/node-v18.14.0.tar.gz
unzip
tar xzvf node-v18.14.0.tar.gz
compile
cd node-v18.14.0
./configure
make
This process may be slow, waiting for it to complete.
Install
sudo make install
If all goes well, Node.js is installed. Use node -v to check the version.
Install npm
npm install