I was trying to install npm, but I got an error: npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
So I searched the internet and found an answer: npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
I wrote
sudo apt-get install nodejs-dev node-gyp libssl1.0-dev
to the console, and it removed a lot of things, here are a few:
Removing ros-melodic-desktop-full (1.4.1-0bionic.20201117.033441) ...
Removing ros-melodic-perception (1.4.1-0bionic.20201017.183309) ...
Removing ros-melodic-perception-pcl (1.7.1-1bionic.20201017.165332) ...
Removing ros-melodic-pcl-ros (1.7.1-1bionic.20201017.110355) ...
Removing ros-melodic-pcl-conversions (1.7.1-1bionic.20201017.091410) ...
Removing libpcl-dev (1.8.1+dfsg1-2ubuntu2.18.04.1) ...
Removing libvtk6-qt-dev (6.3.0+dfsg1-11build1) ...
Removing libvtk6-dev (6.3.0+dfsg1-11build1) ...
Removing ros-melodic-desktop (1.4.1-0bionic.20201117.032830) ...
Removing ros-melodic-urdf-sim-tutorial (0.4.0-0bionic.20201117.031256) ...
Removing ros-melodic-urdf-tutorial (0.4.0-0bionic.20201117.030856) ...
Removing ros-melodic-simulators (1.4.1-0bionic.20201117.032332) ...
Removing ros-melodic-gazebo-ros-pkgs (2.8.7-1bionic.20201017.165057) ...
Removing ros-melodic-gazebo-plugins (2.8.7-1bionic.20201017.110903) ...
Removing ros-melodic-gazebo-ros-control (2.8.7-1bionic.20201017.110855) ...
Removing ros-melodic-robot (1.4.1-0bionic.20201029.172055) ...
dpkg: libignition-fuel-tools1-dev:amd64: dependency problems, but removing anyway as you requested:
libgazebo9-dev:amd64 depends on libignition-fuel-tools1-dev.
Now, The ros projects doesn't run, I was using PX4-Autopilot and now it doesn't run.
$ make px4_sitl gazebo
The output is:
[0/5] Performing build step for 'sitl_gazebo'
[0/1] Re-running CMake...
-- install-prefix: /usr/local
-- cmake build type: RelWithDebInfo
-- Using C++17 standard
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
CMake Error at CMakeLists.txt:47 (find_package):
By not providing "Findgazebo.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "gazebo", but
CMake did not find one.
Could not find a package configuration file provided by "gazebo" with any
of the following names:
gazeboConfig.cmake
gazebo-config.cmake
Add the installation prefix of "gazebo" to CMAKE_PREFIX_PATH or set
"gazebo_DIR" to a directory containing one of the above files. If "gazebo"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/home/sahin/PX4-Autopilot/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeOutput.log".
See also "/home/sahin/PX4-Autopilot/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeError.log".
FAILED: build.ninja
/usr/bin/cmake -H/home/sahin/PX4-Autopilot/Tools/sitl_gazebo -B/home/sahin/PX4-Autopilot/build/px4_sitl_default/build_gazebo
ninja: error: rebuilding 'build.ninja': subcommand failed
[1/5] Generating ../../logs
FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-build
cd /home/sahin/PX4-Autopilot/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build /home/sahin/PX4-Autopilot/build/px4_sitl_default/build_gazebo -- -j1
ninja: build stopped: subcommand failed.
Makefile:224: recipe for target 'px4_sitl' failed
make: *** [px4_sitl] Error 1
Why does this happen? And if I install Ros and the other packages back, will they remove Node?
The specific conflict is between ROS Melodic and an NPM dependency called libcurl4-gnutls-dev. This is the dependency chain: NPM -> node-gyp -> nodejs-dev -> libssl1.0-dev -> libcurl4-gnutls-dev
This link shows how to install NodeJS for use within ROS Melodic (no NPM though, but catkin will attempt to fetch packages during build when not installed): https://answers.ros.org/question/339940/try-to-use-npm-with-ros-melodic-on-ubuntu-1804/
This link shows how to install NodeJS/NPM within a python virtual enviornment: https://stackoverflow.com/questions/65519982/can-not-install-npm-along-side-with-the-ros-melodic