安装 Node-js 删除 ros-melodic-desktop-full

安装 Node-js 删除 ros-melodic-desktop-full

我尝试安装 npm,但出现错误:npm:依赖:node-gyp (>= 0.10.9),但无法安装

于是我在网上搜索并找到了答案: npm:依赖:node-gyp(>= 0.10.9)但不会安装

我写

sudo apt-get install nodejs-dev node-gyp libssl1.0-dev

到控制台,它删除了很多东西,这里列举几个:

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.

现在,ros 项目无法运行,我正在使用 PX4-Autopilot,但现在它无法运行。

$ make px4_sitl gazebo

输出为:

[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

为什么会发生这种情况?如果我重新安装 Ros 和其他软件包,它们会删除 Node 吗?

答案1

具体冲突发生在 ROS Melodic 和名为 libcurl4-gnutls-dev 的 NPM 依赖项之间。这是依赖链:NPM -> node-gyp -> nodejs-dev -> libssl1.0-dev -> libcurl4-gnutls-dev

此链接显示了如何安装 NodeJS 以在 ROS Melodic 中使用(虽然没有 NPM,但当未安装时,catkin 会在构建期间尝试获取包):https://answers.ros.org/question/339940/try-to-use-npm-with-ros-melodic-on-ubuntu-1804/

此链接显示如何在 Python 虚拟环境中安装 NodeJS/NPM:https://stackoverflow.com/questions/65519982/can-not-install-npm-along-side-with-the-ros-melodic

相关内容