Node-red-contrib-mpu9250 couldn't be installed

Hi,

Hi,
I created a flow with node-red-contrib-mpu9250 inside two months ago. It worked fine.
But then, today, after I exported the flow and imported it to another raspberry pi, I couldn't install the
node-red-contrib-mpu9250
Below is the error.
I have also tried npm installl node-red-contrib-mpu9250, still no luck....

Btw, is it possible to export the flow with the library inside?

Thanks,

2021-10-24T11:49:51.820Z Install : node-red-contrib-mpu9250 2.0.2

2021-10-24T11:49:52.581Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-mpu9250@2.0.2
2021-10-24T11:50:00.450Z [err] npm
2021-10-24T11:50:00.451Z [err]  WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
2021-10-24T11:50:02.250Z [out] 
2021-10-24T11:50:02.250Z [out] > sleep@3.0.0 install /root/.node-red/node_modules/sleep
2021-10-24T11:50:02.250Z [out] > node-gyp rebuild
2021-10-24T11:50:02.250Z [out] 
2021-10-24T11:50:03.640Z [out] make: Entering directory '/root/.node-red/node_modules/sleep/build'
2021-10-24T11:50:03.643Z [out]   CXX(target) Release/obj.target/node_sleep/sleep.o
2021-10-24T11:50:05.116Z [err] ../sleep.cc:6:11: error: ‘v8::Handle’ has not been declared
2021-10-24T11:50:05.116Z [err]  using v8::Handle;
2021-10-24T11:50:05.116Z [err]            ^~~~~~
2021-10-24T11:50:05.121Z [err] ../sleep.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE Sleep(Nan::NAN_METHOD_ARGS_TYPE)’:
2021-10-24T11:50:05.121Z [err] ../sleep.cc:42:30: error: no matching function for call to ‘v8::Value::Uint32Value()’
2021-10-24T11:50:05.121Z [err]    sleep(info[0]->Uint32Value());
2021-10-24T11:50:05.121Z [err]                               ^
2021-10-24T11:50:05.121Z [err] In file included from /root/.cache/node-gyp/14.18.1/include/node/node.h:67,
2021-10-24T11:50:05.121Z [err]                  from ../../nan/nan.h:58,
2021-10-24T11:50:05.121Z [err]                  from ../sleep.cc:2:
2021-10-24T11:50:05.121Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
2021-10-24T11:50:05.121Z [err]    V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
2021-10-24T11:50:05.121Z [err]                                          ^~~~~~~~~~~
2021-10-24T11:50:05.121Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
2021-10-24T11:50:05.123Z [err] ../sleep.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE USleep(Nan::NAN_METHOD_ARGS_TYPE)’:
2021-10-24T11:50:05.123Z [err] ../sleep.cc:54:31: error: no matching function for call to ‘v8::Value::Uint32Value()’
2021-10-24T11:50:05.123Z [err]    usleep(info[0]->Uint32Value());
2021-10-24T11:50:05.123Z [err]                                ^
2021-10-24T11:50:05.123Z [err] In file included from /root/.cache/node-gyp/14.18.1/include/node/node.h:67,
2021-10-24T11:50:05.123Z [err]                  from ../../nan/nan.h:58,
2021-10-24T11:50:05.123Z [err]                  from ../sleep.cc:2:
2021-10-24T11:50:05.123Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:2866:41: note: candidate: ‘v8::Maybe<unsigned int> v8::Value::Uint32Value(v8::Local<v8::Context>) const’
2021-10-24T11:50:05.123Z [err]    V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
2021-10-24T11:50:05.123Z [err]                                          ^~~~~~~~~~~
2021-10-24T11:50:05.123Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:2866:41: note:   candidate expects 1 argument, 0 provided
2021-10-24T11:50:05.124Z [err] ../sleep.cc: In function ‘void init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
2021-10-24T11:50:05.124Z [err] ../sleep.cc:62:52: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
2021-10-24T11:50:05.124Z [err]      Nan::New<FunctionTemplate>(Sleep)->GetFunction());
2021-10-24T11:50:05.124Z [err]                                                     ^
2021-10-24T11:50:05.124Z [err] In file included from /root/.cache/node-gyp/14.18.1/include/node/node.h:67,
2021-10-24T11:50:05.124Z [err]                  from ../../nan/nan.h:58,
2021-10-24T11:50:05.124Z [err]                  from ../sleep.cc:2:
2021-10-24T11:50:05.124Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:6482:46: note: candidate: ‘v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)’
2021-10-24T11:50:05.124Z [err]    V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
2021-10-24T11:50:05.124Z [err]                                               ^~~~~~~~~~~
2021-10-24T11:50:05.124Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:6482:46: note:   candidate expects 1 argument, 0 provided
2021-10-24T11:50:05.125Z [err] ../sleep.cc:64:53: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
2021-10-24T11:50:05.125Z [err]      Nan::New<FunctionTemplate>(USleep)->GetFunction());
2021-10-24T11:50:05.125Z [err]                                                      ^
2021-10-24T11:50:05.125Z [err] In file included from /root/.cache/node-gyp/14.18.1/include/node/node.h:67,
2021-10-24T11:50:05.125Z [err]                  from ../../nan/nan.h:58,
2021-10-24T11:50:05.125Z [err]                  from ../sleep.cc:2:
2021-10-24T11:50:05.125Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:6482:46: note: candidate: ‘v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)’
2021-10-24T11:50:05.125Z [err]    V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
2021-10-24T11:50:05.125Z [err]                                               ^~~~~~~~~~~
2021-10-24T11:50:05.125Z [err] /root/.cache/node-gyp/14.18.1/include/node/v8.h:6482:46: note:   candidate expects 1 argument, 0 provided
2021-10-24T11:50:05.126Z [err] In file included from ../../nan/nan.h:58,
2021-10-24T11:50:05.126Z [err]                  from ../sleep.cc:2:
2021-10-24T11:50:05.126Z [err] ../sleep.cc: At global scope:
2021-10-24T11:50:05.126Z [err] /root/.cache/node-gyp/14.18.1/include/node/node.h:787:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
2021-10-24T11:50:05.126Z [err]        (node::addon_register_func) (regfunc),                          \
2021-10-24T11:50:05.126Z [err]                                            ^
2021-10-24T11:50:05.126Z [err] /root/.cache/node-gyp/14.18.1/include/node/node.h:821:3: note: in expansion of macro ‘NODE_MODULE_X’
2021-10-24T11:50:05.126Z [err]    NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
2021-10-24T11:50:05.126Z [err]    ^~~~~~~~~~~~~
2021-10-24T11:50:05.126Z [err] ../sleep.cc:68:1: note: in expansion of macro ‘NODE_MODULE’
2021-10-24T11:50:05.126Z [err]  NODE_MODULE(node_sleep, init)
2021-10-24T11:50:05.126Z [err]  ^~~~~~~~~~~
2021-10-24T11:50:05.321Z [err] make: *** [node_sleep.target.mk:109: Release/obj.target/node_sleep/sleep.o] Error 1
2021-10-24T11:50:05.321Z [out] make: Leaving directory '/root/.node-red/node_modules/sleep/build'
2021-10-24T11:50:05.323Z [err] gyp
2021-10-24T11:50:05.324Z [err]  
2021-10-24T11:50:05.324Z [err] ERR! build error 
2021-10-24T11:50:05.326Z [err] gyp 
2021-10-24T11:50:05.326Z [err] ERR! stack Error: `make` failed with exit code: 2
2021-10-24T11:50:05.326Z [err] gyp
2021-10-24T11:50:05.326Z [err]  ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
2021-10-24T11:50:05.326Z [err] gyp 
2021-10-24T11:50:05.326Z [err] ERR! stack     at ChildProcess.emit (events.js:400:28)
2021-10-24T11:50:05.326Z [err] gyp ERR! stack
2021-10-24T11:50:05.326Z [err]      at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
2021-10-24T11:50:05.327Z [err] gyp 
2021-10-24T11:50:05.327Z [err] ERR! System Linux 5.10.17-v7l+
2021-10-24T11:50:05.327Z [err] gyp ERR! command
2021-10-24T11:50:05.327Z [err]  "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2021-10-24T11:50:05.327Z [err] gyp 
2021-10-24T11:50:05.327Z [err] ERR! cwd /root/.node-red/node_modules/sleep
2021-10-24T11:50:05.327Z [err] gyp ERR! node -v v14.18.1
2021-10-24T11:50:05.328Z [err] gyp ERR! node-gyp -v v5.1.0
2021-10-24T11:50:05.328Z [err] gyp ERR! not ok 
2021-10-24T11:50:05.602Z [err] npm
2021-10-24T11:50:05.602Z [err]  ERR! code ELIFECYCLE
2021-10-24T11:50:05.602Z [err] npm ERR!
2021-10-24T11:50:05.602Z [err]  errno 1
2021-10-24T11:50:05.630Z [err] npm ERR!
2021-10-24T11:50:05.630Z [err]  sleep@3.0.0 install: `node-gyp rebuild`
2021-10-24T11:50:05.630Z [err] npm ERR! Exit status 1
2021-10-24T11:50:05.630Z [err] npm 
2021-10-24T11:50:05.630Z [err] ERR! 
2021-10-24T11:50:05.630Z [err] npm ERR! Failed at the sleep@3.0.0 install script.
2021-10-24T11:50:05.630Z [err] npm
2021-10-24T11:50:05.630Z [err]  ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-24T11:50:05.650Z [err] 
2021-10-24T11:50:05.650Z [err] npm ERR! A complete log of this run can be found in:
2021-10-24T11:50:05.650Z [err] npm ERR!     /root/.npm/_logs/2021-10-24T11_50_05_634Z-debug.log
2021-10-24T11:50:05.664Z rc=1

What version of nodejs are you using in the system that works. I see it is 14.8.1 in the failure. Use node -v to find out. Are the two systems on similar hardware/os? What hardware/OS is it? Often this sort of error is caused by a nodejs incompatibility.

I see you are running node red as root. Generally that is a bad thing, though it should not be a factor with this problem, as far as I can see.

Hi,

The new SD card: "node -v" is v14.18.1
The old SD card: "node -v" is v10.24.0
I am trying both SD card on the same hardware.

I am trying to downgrade it by following this link, How to Upgrade (or Downgrade) Node.js Using npm | Surreal CMS

There is still some trouble of the node. I am going to make a new SD card.
What is a proper way to install a specific version of node-red? "node -v" is the node.js version, How to see the node red version? Thx
Thanks

That depends how you are planning to install node red in the first place. If you are using the recommended method for installing on a Pi/Ubuntu/Debian system then add --help to the bash <(curl.. command to tell you how to do that. However, I think the script now requires you to install at least node 12. Trying to use nodejs 10 is going to be problematic as it is no longer supported by node-red.

Why don't you just make an image copy of the working card and go with that?

That is my plan B... Still have problem...


Failed to install: node-red-contrib-mpu9250

Install failed

Check the log for more information

Why the version is still v14.18.1.... :< I am doing downgrade one more time...
I am still googling for a proper way to install specific version.....

The technique you are using to downgrade is not correct.
What does this give
apt-cache policy nodejs

apt-cache policy nodejs
nodejs:
Installed: 14.18.1-deb-1nodesource1
Candidate: 14.18.1-deb-1nodesource1
Version table:
*** 14.18.1-deb-1nodesource1 500
500 https://deb.nodesource.com/node_14.x buster/main armhf Packages
100 /var/lib/dpkg/status
10.24.0~dfsg-1~deb10u1 500
500 Index of /raspbian buster/main armhf Packages

Only serial port has problem now. But I cannot remove it and reinstall it. :<


2021-10-24T14:55:44.128Z Remove : node-red-node-serialport

pi@raspberrypi:~ $ npm install node-red-node-serialport
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

  • node-red-node-serialport@0.14.1
    updated 1 package and audited 138 packages in 2.452s

17 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

Hi,

Here is the update
After reboot and remove several times, the serialport works.
However, for the MPU9250 does not have anything comes out. I am using the same hardware...

Hi,

After removing the MPU9250 and install it again, it works now.
Thanks for your help.
Cheers

looks like a known install issue: Issues installing the module: node-red-contrib-mpu9250 2.0.2 (#1) · Issues · Benoit Lavorata / node-red-contrib-mpu9250 · GitLab
cc @Colin

Here is what I did

  1. delete the MPU9250 node in the flow
  2. Deploy
  3. remove the MPU9250 in palette
  4. install the MPU9250

Cheers

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.