We use the official website direct download compiled binary file to install.
Right-click on the red circle to the official website of content, copy the download address;
To the
cd /usr/local
directory, usewget https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz
the download package;Use the
tar -xJf node-v10.16.3-linux-x64.tar.xz
command to extract;Configure the environment variables:
vi /etc/profile
Finally, add
export NODE_HOME=/usr/local/node-v10.16.3-linux-x64
export PATH=$NODE_HOME/bin:$PATH
Save and exit, the implementation of source / etc / profile so that the environment variables to take effect;
- In turn enter
node -v
andnpm -v
verify that the installation was successful.