0

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.

Rishon_JR
  • 1,028

1 Answers1

0

Firstly, you can install npm on Ubuntu 22.04 LTS by opening terminal and run the following commands:

$ sudo apt update

$ sudo apt install npm

After that, you can install nodemon globally on our system with the following command:

$ sudo npm install -g nodemon

I tested and installed nodemon successfully on my Ubuntu 22.04.2 LTS server. Hope this help you fix your problem.