Search code examples
node.jsros

Can not Install NPM along side with the ROS melodic?


I am using ROS melodic for my current project but I need to install nodejs for my college work in ubuntu 18.04. When I install nodejs by using the following commands

sudo apt install nodejs
sudo apt install npm

it gives me an error like this. error

So I installed that dependency but after installing that dependency my ros packages removed.
How can I install the npm without losing the ROS melodic?

Thanks in advance !!


Solution

  • I found something on the internet that take me to the solution, I installed python virtual environment

    https://linuxize.com/post/how-to-create-python-virtual-environments-on-ubuntu-18-04/

    in that virtual environment I installed nodeenv with the help of pip

    https://pypi.org/project/nodeenv/#id73

    I created node.js virtual environment in which I installed the NPM without getting any error. enter image description here

    And we can also install nodeenv with the global environment too!