In N99panel we offer multiple versions of NodeJS with associated NPM versions. But there may be a use case or a scenario where you simply need the default node and/or npm command. To accomplish this, following needs to be done. Here we assume a user with a username user1 . And in this example we will make node16 and its corresponding accompanying npm16, as the default versions. You may use the appropriate version numbers in your particular scenario.
- Login via SFTP using user1 credentials
- Download the file /home/user1/.bashrc into your local computer
- Make a backup copy of the file .bashrc as .bashrc_bak ( as a precautionary measure )
- Open the file .bashrc in your favorite text editor like notepad++ or Visual Studio Code
- At the bottom of this file at/around line 115 , you would find the following line
export PATH="/var/node-custom/bin:$PATH"
Change this line to
export PATH="$HOME/bin:/var/node-custom/bin:$PATH"
and save the file.
- Upload the changed .bashrc file and replace the current .bashrc file
- Now SSH into the server and run the following commands
mkdir /home/user1/bin
ln -s /var/node-custom/bin/node16 /home/user1/bin/node
ln -s /var/node-custom/bin/npm16 /home/user1/bin/npm - Now logout and re-login into the SSH Server.
Now you should have a working node and npm command . To verify the same, please run
node -v
npm -v
This should return the version numbers of node and npm.