Sometimes the installation of website programs requires the version of node. Today I will talk about how to upgrade node to the latest version.
We talked about some basic content before, and you can refer to relevant knowledge.
Basic configuration of cloud services: Tencent cloud server Xiaobai nanny level tutorial - Dapeng bmfm's blog - CSDN blog
Node installation tutorial Tencent cloud server installation node_Doc bmfm's blog-CSDN blog
1. View the current version
node -v
2. Clear the cache of Node.js
npm cache clean -f
After testing, if it is not used, this step is dispensable.
I am the root user here, if it is a general user: sudo npm cache clean -f
3. Use npm to install the n module
The n module is a multi-version manager for node, which can be used to upgrade.
npm install -g n
4. View all versions of node
npm view node versions
5. Upgrade the version, here I chose to upgrade to a stable version
n stable
Other commands can refer to the following
// Upgrade to the latest version
sudo n latest
// Upgrade to a stable version
sudo n stable
// Upgrade to a specific version number
sudo n xx.xx
report error
Solution:
Excuting an order
npm install -g n
return
Enter the n directory:
cd /opt/node-v10.13.0-linux-x64/lib/node_modules/n/bin
Excuting an order
./n stable
Check node version
In the next issue, we will talk about how to configure github. The goal is to build your own gpt website. Please continue to pay attention.
If you can't wait for the new one, you can private me and mark it as gpt.