background:
A few days ago Ali cloud has deployed a project node, node version v12.10.0
Each re-connected to the remote input node -v / pm2 -v display command not found;
Every time you must enter nvm use v12.10.0, you can use the normal use of node / pm2
solve:
Queries whether node
echo $PATH //查看是否有/usr/local/bin。 ls -l /usr/local/bin | grep node //看看node是否确实存在。 ls -l /usr/local/bin/node //同上
Create a soft associative link (shortcut similar to the Windows)
Enter the command: to create a soft link to usr / local / bin / / node down
[root@xxx ~]# which node
/root/.nvm/versions/node/v12.10.0/bin/node
[root@xxx ~]# ln -s /root/.nvm/versions/node/v12.10.0/bin/node /usr/local/bin/node
So each node command after the connection has, however, there is a problem, nvm points to the system, do not know if every point v12.10.0 ?, chiefs seek correction
[root@xxx ~]# nvm ls
v12.10.0
-> system
Tip:
- Soft links, has been flashing red question: in all likelihood be a reference path error
- Delete soft link: Enter the directory soft link RM -rf ./node (delete soft links, but does not delete the actual data), do not use the RM -rf ./node/ (this will be the contents of the original node deleted)
- Find the node directory: the Find -name 'v12.10.0'