Initially I installed node using the command sudo apt install nodejs
. This command installed an older version of node and npm so I removed the package using the command
sudo apt-get remove --purge nodejs
.
To get the latest LTS version of nodejs I download the zip file extracted it to the path /usr/local/lib/nodejs/
.
After this to set the environment variable of nodejs I took the path of nodejs bin file, then configured the path to .bashrc
file which was present in the home directory.
This is how I installed the latest LTS version of nodejs and npm. I also verified the installation by checking the versions of node and npm in my system.
Now when I run npm install -g nodemon
it gives me error stating that you need specific permissions to do so.
Then I tried sudo npm install -g nodemon
, now it says command not found.
But I can install nodemon locally (i.e npm install nodemon
works fine but still can't start the node server using nodemon). What I want is to install nodemon globally and use it to start my server
I googled around and tried several things but it didn't really work for me.
Newbie here... It's been two weeks where I have totally wiped windows from my system and installed ubuntu in it.
To get the latest LTS version of nodejs i download the zip file extracted it to the path /usr/local/lib/nodejs/
After this to set the environment variable of nodejs I took the path of nodejs bin file, then configured the path to .bashrc file which was present in the home directory.
This is how I installed the latest LTS version of nodejs and npm.
Thank you
– Robin Sharma Feb 25 '23 at 08:05