RobotWebTools / ros2-web-bridge

Bridging your browser to the ROS 2.0
Apache License 2.0
205 stars 68 forks source link

“npm install” error #106

Closed lxbeyond closed 6 years ago

lxbeyond commented 6 years ago

I git clone this rep, and I run "npm install", then get the error: npm install

ref@1.3.5 install /home/hzh/xinliu/ros2-web-bridge/node_modules/ref node-gyp rebuild

make: Entering directory '/home/hzh/xinliu/ros2-web-bridge/node_modules/ref/build' CXX(target) Release/obj.target/binding/src/binding.o ../src/binding.cc: In function ‘void init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’: ../src/binding.cc:643:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("endianness").ToLocalChecked(), Nan::New(CheckEndianness()). ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:643:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("endianness").ToLocalChecked(), Nan::New(CheckEndianness()). ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:643:187: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] ed(), Nan::New(CheckEndianness()).ToLocalChecked(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:644:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("NULL").ToLocalChecked(), WrapNullPointer(), static_cast<PropertyAttribu ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:644:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("NULL").ToLocalChecked(), WrapNullPointer(), static_cast<PropertyAttribu ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:644:142: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] n::New("NULL").ToLocalChecked(), WrapNullPointer(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ SOLINK_MODULE(target) Release/obj.target/binding.node COPY Release/binding.node make: Leaving directory '/home/hzh/xinliu/ros2-web-bridge/node_modules/ref/build'

puppeteer@1.7.0 install /home/hzh/xinliu/ros2-web-bridge/node_modules/puppeteer node install.js

Downloading Chromium r579032 - 102.3 Mb [====================] 100% 0.0s Chromium downloaded to /home/hzh/xinliu/ros2-web-bridge/node_modules/puppeteer/.local-chromium/linux-579032

rclnodejs@0.4.2 install /home/hzh/xinliu/ros2-web-bridge/node_modules/rclnodejs node-gyp rebuild

console.log(process.env.COLCON_PREFIX_PATH.replace(/:/, '/include/ ') + '/include/') ^

TypeError: Cannot read property 'replace' of undefined at eval:1:44 at ContextifyScript.Script.runInThisContext (vm.js:50:33) at Object.runInThisContext (vm.js:139:38) at Object. (eval-wrapper:6:22) at Module._compile (module.js:652:30) at evalScript (bootstrap_node.js:466:27) at startup (bootstrap_node.js:167:9) at bootstrap_node.js:612:3 gyp: Call to 'node -e "console.log(process.env.COLCON_PREFIX_PATH.replace(/:/, '/include/ ') + '/include/')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Linux 4.15.0-30-generic gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/hzh/xinliu/ros2-web-bridge/node_modules/rclnodejs gyp ERR! node -v v8.11.2 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rclnodejs@0.4.2 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rclnodejs@0.4.2 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/hzh/.npm/_logs/2018-08-21T11_36_13_719Z-debug.log

and the node version is v8.11.2 , nvm version is : 0.33.11

qiuzhong commented 6 years ago

This error occurred because the COLCON_PREFIX_PATH environment variable is not set while install the rclnodejs dependency. Please check if had loaded the ROS2 environment? Please check it by: $ echo $AMENT_PREFIX_PATH.

lxbeyond commented 6 years ago

I use the ros2 bouncy, after I source the local_setup.bash, AMENT_PREFIX_PATH was set, but I still get the error : $ npm install

ref@1.3.5 install /home/xinliu/octopus3/ros2-web-bridge/node_modules/ref node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR make: Entering directory '/home/xinliu/octopus3/ros2-web-bridge/node_modules/ref/build' CXX(target) Release/obj.target/binding/src/binding.o ../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::WriteInt64(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/binding.cc:360:30: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local)’ is deprecated: Use Isolate version [-Wdeprecated-declarations] String::Utf8Value _str(in); ^ In file included from /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:26:0, from /home/xinliu/.node-gyp/10.9.0/include/node/node.h:63, from ../src/binding.cc:5: /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:2875:28: note: declared here explicit Utf8Value(Local obj)); ^ /home/xinliu/.node-gyp/10.9.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’ declarator attribute((deprecated(message))) ^ ../src/binding.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE {anonymous}::WriteUInt64(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/binding.cc:447:30: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local)’ is deprecated: Use Isolate version [-Wdeprecated-declarations] String::Utf8Value _str(in); ^ In file included from /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:26:0, from /home/xinliu/.node-gyp/10.9.0/include/node/node.h:63, from ../src/binding.cc:5: /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:2875:28: note: declared here explicit Utf8Value(Local obj)); ^ /home/xinliu/.node-gyp/10.9.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’ declarator attribute((deprecated(message))) ^ ../src/binding.cc: In function ‘void init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’: ../src/binding.cc:643:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("endianness").ToLocalChecked(), Nan::New(CheckEndianness()).ToLocalChecked(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:643:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("endianness").ToLocalChecked(), Nan::New(CheckEndianness()).ToLocalChecked(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:643:187: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("endianness").ToLocalChecked(), Nan::New(CheckEndianness()).ToLocalChecked(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:644:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("NULL").ToLocalChecked(), WrapNullPointer(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:644:8: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("NULL").ToLocalChecked(), WrapNullPointer(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ ../src/binding.cc:644:142: warning: ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New("NULL").ToLocalChecked(), WrapNullPointer(), static_cast(ReadOnly|DontDelete)); ^ In file included from ../../nan/nan.h:197:0, from ../src/binding.cc:7: ../../nan/nan_maybe_43_inl.h:130:35: note: declared here NAN_DEPRECATED inline Maybe ForceSet( ^ SOLINK_MODULE(target) Release/obj.target/binding.node COPY Release/binding.node make: Leaving directory '/home/xinliu/octopus3/ros2-web-bridge/node_modules/ref/build'

rclnodejs@0.4.2 install /home/xinliu/octopus3/ros2-web-bridge/node_modules/rclnodejs node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR make: Entering directory '/home/xinliu/octopus3/ros2-web-bridge/node_modules/rclnodejs/build' CXX(target) Release/obj.target/rclnodejs/src/addon.o CXX(target) Release/obj.target/rclnodejs/src/executor.o CXX(target) Release/obj.target/rclnodejs/src/handle_manager.o CXX(target) Release/obj.target/rclnodejs/src/rcl_bindings.o ../src/rcl_bindings.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE rclnodejs::CreateNode(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/rcl_bindings.cpp:49:55: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local)’ is deprecated: Use Isolate version [-Wdeprecated-declarations] std::string node_name(v8::String::Utf8Value(info[0])); ^ In file included from /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:26:0, from /home/xinliu/.node-gyp/10.9.0/include/node/node.h:63, from ../../nan/nan.h:51, from ../src/rcl_bindings.hpp:18, from ../src/rcl_bindings.cpp:15: /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:2875:28: note: declared here explicit Utf8Value(Local obj)); ^ /home/xinliu/.node-gyp/10.9.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’ declarator attribute((deprecated(message))) ^ ../src/rcl_bindings.cpp:50:56: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local)’ is deprecated: Use Isolate version [-Wdeprecated-declarations] std::string name_space(v8::String::Utf8Value(info[1])); ^ In file included from /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:26:0, from /home/xinliu/.node-gyp/10.9.0/include/node/node.h:63, from ../../nan/nan.h:51, from ../src/rcl_bindings.hpp:18, from ../src/rcl_bindings.cpp:15: /home/xinliu/.node-gyp/10.9.0/include/node/v8.h:2875:28: note: declared here explicit Utf8Value(Local obj)); ^ /home/xinliu/.node-gyp/10.9.0/include/node/v8config.h:324:3: note: in definition of macro ‘V8_DEPRECATED’ declarator attribute((deprecated(message))) ^ In file included from ../src/rcl_bindings.cpp:33:0: ../src/rcl_bindings.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE rclnodejs::CreateTimer(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/rcl_bindings.cpp:82:79: error: invalid conversion from ‘rcl_clock_t’ to ‘int64_t {aka long int}’ [-fpermissive] nullptr, rcl_get_default_allocator()), ^ ../src/macros.hpp:20:16: note: in definition of macro ‘CHECK_OP_AND_THROW_ERROR_IF_NOT_TRUE’ if (lhs op rhs) { \ ^ ../src/rcl_bindings.cpp:80:3: note: in expansion of macro ‘THROW_ERROR_IF_NOT_EQUAL’ THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, ^ /home/xinliu/ros2_bouncy/zoro-linux/include/rcutils/time.h:32:54: error: invalid conversion from ‘int64_t {aka long int}’ to ‘rcl_timer_callback_t {aka void ()(rcl_timer_t*, long int)}’ [-fpermissive]

define RCUTILS_MS_TO_NS(milliseconds) (milliseconds (1000 1000))

                                                  ^

../src/macros.hpp:20:16: note: in definition of macro ‘CHECK_OP_AND_THROW_ERROR_IF_NOT_TRUE’ if (lhs op rhs) { \ ^ ../src/rcl_bindings.cpp:80:3: note: in expansion of macro ‘THROW_ERROR_IF_NOT_EQUAL’ THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, ^ /home/xinliu/ros2_bouncy/zoro-linux/include/rcl/time.h:32:22: note: in expansion of macro ‘RCUTILS_MS_TO_NS’

define RCL_MS_TO_NS RCUTILS_MS_TO_NS

                  ^

../src/rcl_bindings.cpp:81:57: note: in expansion of macro ‘RCL_MS_TO_NS’ rcl_timer_init(timer, clock, RCL_MS_TO_NS(period_ms), ^ ../src/rcl_bindings.cpp:82:79: error: could not convert ‘nullptr’ from ‘std::nullptr_t’ to ‘rcl_allocator_t {aka rcutils_allocator_t}’ nullptr, rcl_get_default_allocator()), ^ ../src/macros.hpp:20:16: note: in definition of macro ‘CHECK_OP_AND_THROW_ERROR_IF_NOT_TRUE’ if (lhs op rhs) { \ ^ ../src/rcl_bindings.cpp:80:3: note: in expansion of macro ‘THROW_ERROR_IF_NOT_EQUAL’ THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, ^ rclnodejs.target.mk:124: recipe for target 'Release/obj.target/rclnodejs/src/rcl_bindings.o' failed make: *** [Release/obj.target/rclnodejs/src/rcl_bindings.o] Error 1 make: Leaving directory '/home/xinliu/octopus3/ros2-web-bridge/node_modules/rclnodejs/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/xinliu/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12) gyp ERR! System Linux 4.15.0-32-generic gyp ERR! command "/home/xinliu/.nvm/versions/node/v10.9.0/bin/node" "/home/xinliu/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/xinliu/octopus3/ros2-web-bridge/node_modules/rclnodejs gyp ERR! node -v v10.9.0 gyp ERR! node-gyp -v v3.7.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rclnodejs@0.4.2 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rclnodejs@0.4.2 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:

qiuzhong commented 6 years ago

This is a frequent error recently. This root cause is RCL native APIs changed after ROS2 bouncy release and rclnodejs always keeps aligned with the latest RCL native APIs. This is a little annoying. You can:

minggangw commented 6 years ago

@lxbeyond If you have to build against bouncy release, I recommend that you install the rclnodejs from Github which locates at https://github.com/RobotWebTools/rclnodejs/tree/bouncy-bolson, it should work well. Thanks!

lxbeyond commented 6 years ago

I build rclnodejs well from github bouncy-bolson branch, but error when build ros2-web-bridge , and I do not konw how to make ros2-web-bridge to use rclnodejs of bouncy-bolson version . @minggangw

minggangw commented 6 years ago

You could change your package.json

"rclnodejs": "^0.4.0",

please reference the document of npm to change it to Github url, hope it works.

lxbeyond commented 6 years ago

I changed package.json "rclnodejs": "git://github.com/RobotWebTools/rclnodejs.git#bouncy-bolson", and it works, thanks @minggangw @qiuzhong

minggangw commented 6 years ago

So I think this issue can be closed now, feel free to reopen if you meet any problem in the future. Thanks!