RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/humble/Concepts/Basic/About-Client-Libraries.html?highlight=rclnodejs#community-maintained
Apache License 2.0
312 stars 70 forks source link

rclnodejs npm install error #815

Closed JosephRivera10 closed 2 years ago

JosephRivera10 commented 2 years ago

Description Receiving the following error when trying to install rclnodejs version 0.20.0

Steps To Reproduce ROS 2 installed and working by these guidelines (https://docs.ros.org/en/rolling/Installation/macOS-Development-Setup.html). SIP has already been disabled. Using node v12.22.4 (npm v6.14.15)

` ~/Desktop/Robot_UI/don-ui (git::galactic) $ npm i

int64-napi@1.0.2 install /Users/maidbot/Desktop/Robot_UI/don-ui/node_modules/int64-napi node-gyp rebuild

CC(target) Release/obj.target/int64/c/int64.o ../c/int64.c:55:54: warning: incompatible pointer types passing 'uint64_t ' (aka 'unsigned long long ') to parameter of type 'size_t ' (aka 'unsigned long ') [-Wincompatible-pointer-types] napi_get_buffer_info(env, _raw, (void*)raw, &rawLength); ^~~~~~ /Users/maidbot/Library/Caches/node-gyp/12.22.4/include/node/node_api.h:158:54: note: passing argument to parameter 'length' here size_t length); ^ 1 warning generated. SOLINK_MODULE(target) Release/int64.node

ref-napi@2.1.2 install /Users/maidbot/Desktop/Robot_UI/don-ui/node_modules/ref-napi node-gyp-build

rclnodejs@0.14.1 install /Users/maidbot/Desktop/Robot_UI/don-ui/node_modules/rclnodejs node-gyp rebuild

CXX(target) Release/obj.target/rclnodejs/src/addon.o In file included from ../src/addon.cpp:23: In file included from ../src/shadow_node.hpp:24: ../src/executor.hpp:27:8: error: definition of type 'rcl_context_t' conflicts with typedef of the same name struct rcl_context_t; ^ /Users/maidbot/ros2_rolling/install/rcl/include/rcl/context.h:150:3: note: 'rcl_context_t' declared here } rcl_context_t; ^ 1 error generated. make: *** [Release/obj.target/rclnodejs/src/addon.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/maidbot/.nvm/versions/node/v12.22.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:314:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/Users/maidbot/.nvm/versions/node/v12.22.4/bin/node" "/Users/maidbot/.nvm/versions/node/v12.22.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/maidbot/Desktop/Robot_UI/don-ui/node_modules/rclnodejs gyp ERR! node -v v12.22.4 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rclnodejs@0.14.1 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rclnodejs@0.14.1 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/maidbot/.npm/_logs/2021-10-20T15_33_06_012Z-debug.log`

rafaneri commented 2 years ago

Same error here, but my environment is:

Library Version: 0.20.1 ROS Version: Ros 2 - Foxy Fitzroy Platform / OS: Ubuntu 20.04 / Rasp 3

ubuntu@ubuntu:~/Documents/nodetest$ npm i rclnodejs

> int64-napi@1.0.2 install /home/ubuntu/Documents/nodetest/node_modules/int64-napi
> node-gyp rebuild

make: Entering directory '/home/ubuntu/Documents/nodetest/node_modules/int64-napi/build'
  CC(target) Release/obj.target/int64/c/int64.o
  SOLINK_MODULE(target) Release/obj.target/int64.node
  COPY Release/int64.node
make: Leaving directory '/home/ubuntu/Documents/nodetest/node_modules/int64-napi/build'

> ref-napi@3.0.3 install /home/ubuntu/Documents/nodetest/node_modules/ref-napi
> node-gyp-build

> rclnodejs@0.20.1 install /home/ubuntu/Documents/nodetest/node_modules/rclnodejs
> node-gyp rebuild

make: Entering directory '/home/ubuntu/Documents/nodetest/node_modules/rclnodejs/build'
  CXX(target) Release/obj.target/rclnodejs/src/addon.o
In file included from /opt/ros/foxy/include/rmw/init_options.h:26,
                 from /opt/ros/foxy/include/rmw/init.h:25,
                 from /opt/ros/foxy/include/rcl/context.h:23,
                 from /opt/ros/foxy/include/rcl/init.h:24,
                 from /opt/ros/foxy/include/rcl/rcl.h:76,
                 from ../src/rcl_action_bindings.hpp:19,
                 from ../src/addon.cpp:18:
/opt/ros/foxy/include/rmw/domain_id.h:13:2: warning: null character(s) ignored
   13 | ( ???         ? language governing permissions and
      |  ^
/opt/ros/foxy/include/rmw/domain_id.h:13:3: error: stray ‘\1’ in program
   13 | ( ???         ? language governing permissions and
      |   ^
/opt/ros/foxy/include/rmw/domain_id.h:13:4: error: stray ‘\316’ in program
   13 | ( ???         ? language governing permissions and
      |    ^
/opt/ros/foxy/include/rmw/domain_id.h:13:5: error: stray ‘\360’ in program
   13 | ( ???         ? language governing permissions and
      |     ^
/opt/ros/foxy/include/rmw/domain_id.h:13:6: error: stray ‘\320’ in program
   13 | ( ???         ? language governing permissions and
      |      ^
/opt/ros/foxy/include/rmw/domain_id.h:13:7: warning: null character(s) ignored
   13 | ( ???         ? language governing permissions and
      |       ^
/opt/ros/foxy/include/rmw/domain_id.h:13:9: error: stray ‘\20’ in program
   13 | ( ???         ? language governing permissions and
      |         ^
/opt/ros/foxy/include/rmw/domain_id.h:13:10: warning: null character(s) ignored
   13 | ( ???         ? language governing permissions and
      |          ^
/opt/ros/foxy/include/rmw/domain_id.h:13:17: error: stray ‘\342’ in program
   13 | ( ???         ? language governing permissions and
      |                 ^
In file included from /opt/ros/foxy/include/rcl/domain_id.h:27,
                 from /opt/ros/foxy/include/rcl/node_options.h:26,
                 from /opt/ros/foxy/include/rcl/node.h:29,
                 from /opt/ros/foxy/include/rcl/rcl.h:77,
                 from ../src/rcl_action_bindings.hpp:19,
                 from ../src/addon.cpp:18:
/opt/ros/foxy/include/rmw/domain_id.h:13:2: warning: null character(s) ignored
   13 | ( ???         ? language governing permissions and
      |  ^
/opt/ros/foxy/include/rmw/domain_id.h:13:3: error: stray ‘\1’ in program
   13 | ( ???         ? language governing permissions and
      |   ^
/opt/ros/foxy/include/rmw/domain_id.h:13:4: error: stray ‘\316’ in program
   13 | ( ???         ? language governing permissions and
      |    ^
/opt/ros/foxy/include/rmw/domain_id.h:13:5: error: stray ‘\360’ in program
   13 | ( ???         ? language governing permissions and
      |     ^
/opt/ros/foxy/include/rmw/domain_id.h:13:6: error: stray ‘\320’ in program
   13 | ( ???         ? language governing permissions and
      |      ^
/opt/ros/foxy/include/rmw/domain_id.h:13:7: warning: null character(s) ignored
   13 | ( ???         ? language governing permissions and
      |       ^
/opt/ros/foxy/include/rmw/domain_id.h:13:9: error: stray ‘\20’ in program
   13 | ( ???         ? language governing permissions and
      |         ^
/opt/ros/foxy/include/rmw/domain_id.h:13:10: warning: null character(s) ignored
   13 | ( ???         ? language governing permissions and
      |          ^
/opt/ros/foxy/include/rmw/domain_id.h:13:17: error: stray ‘\342’ in program
   13 | ( ???         ? language governing permissions and
      |                 ^
In file included from /opt/ros/foxy/include/rmw/init_options.h:26,
                 from /opt/ros/foxy/include/rmw/init.h:25,
                 from /opt/ros/foxy/include/rcl/context.h:23,
                 from /opt/ros/foxy/include/rcl/init.h:24,
                 from /opt/ros/foxy/include/rcl/rcl.h:76,
                 from ../src/rcl_action_bindings.hpp:19,
                 from ../src/addon.cpp:18:
/opt/ros/foxy/include/rmw/domain_id.h:13:27: error: expected ‘)’ before ‘governing’
   13 | ( ???         ? language governing permissions and
      | ~                         ^~~~~~~~~~
      |                           )
In file included from /opt/ros/foxy/include/rcl/domain_id.h:27,
                 from /opt/ros/foxy/include/rcl/node_options.h:26,
                 from /opt/ros/foxy/include/rcl/node.h:29,
                 from /opt/ros/foxy/include/rcl/rcl.h:77,
                 from ../src/rcl_action_bindings.hpp:19,
                 from ../src/addon.cpp:18:
/opt/ros/foxy/include/rmw/domain_id.h:13:27: error: expected ‘)’ before ‘governing’
   13 | ( ???         ? language governing permissions and
      | ~                         ^~~~~~~~~~
      |                           )
make: *** [rclnodejs.target.mk:134: Release/obj.target/rclnodejs/src/addon.o] Error 1
make: Leaving directory '/home/ubuntu/Documents/nodetest/node_modules/rclnodejs/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
gyp ERR! System Linux 5.4.0-1042-raspi
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/Documents/nodetest/node_modules/rclnodejs
gyp ERR! node -v v14.18.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN notsup Unsupported engine for rclnodejs@0.20.1: wanted: {"node":">= 10.23.1 <13.0.0"} (current: {"node":"14.18.1","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: rclnodejs@0.20.1
npm WARN nodetest@1.0.0 No description
npm WARN nodetest@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rclnodejs@0.20.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the rclnodejs@0.20.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2021-11-30T13_01_09_701Z-debug.log
rafaneri commented 2 years ago

I get the same error using node 12.x

rafaneri commented 2 years ago

@ros2jsguy some trick here?

wayneparrott commented 2 years ago

@rafaneri From the output you shared line #13 of /opt/ros/foxy/include/rmw/domain_id.h is corrupted. Try opening this file in an editor such as VSCode that will enable you to view whitespace and control chars. Delete all unicode and control chars from the file and save. Then cross fingers and try reinstalling rclnodejs, i.e., npm i rclnodejs.

I ran a quick test and confirmed that I can install & build rclnodejs v0.20.1 from npmjs registry with no issues on linux 20.04, nodejs 12 & ros2 foxy distro.

wayneparrott commented 2 years ago

with the release of v0.21.0 this issue should be resolved.