Code ENOLOCAL Error when installing Node: mpu9250

Hi,
Only when I try to install this module, I get this error: there is a simple explanation (Never had something like it):

pi@raspberrypi:~/.node-red $ npm install /path/to/node-red-contrib-mpu9250
npm ERR! code ENOLOCAL
npm ERR! Could not install from "../../../path/to/node-red-contrib-mpu9250" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-11-17T13_49_19_131Z-debug.log

Thanks for your experties.
Andrea

The error seems quite clear, that folder does not contain a file package.json

Why are you attempting to install from a folder rather than from npm?

I tried to do the installation from Node-Red :Manage Palette with the following result:

2020-11-17T13:47:14.523Z Install : node-red-contrib-mpu9250 2.0.2

2020-11-17T13:47:14.541Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix="~" --production node-red-contrib-mpu9250@2.0.2
2020-11-17T13:47:25.042Z [err] npm
2020-11-17T13:47:25.043Z [err] WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
2020-11-17T13:47:28.263Z [out]
2020-11-17T13:47:28.263Z [out] > sleep@3.0.0 install /home/pi/.node-red/node_modules/sleep
2020-11-17T13:47:28.263Z [out] > node-gyp rebuild
2020-11-17T13:47:28.263Z [out]
2020-11-17T13:47:30.873Z [out] make: Entering directory '/home/pi/.node-red/node_modules/sleep/build'
2020-11-17T13:47:30.882Z [out] CXX(target) Release/obj.target/node_sleep/sleep.o
2020-11-17T13:47:33.925Z [err] ../sleep.cc:6:11: error: ‘v8::Handle’ has not been declared
2020-11-17T13:47:33.925Z [err] using v8::Handle;
2020-11-17T13:47:33.925Z [err] ^~~~~~
2020-11-17T13:47:33.925Z [err] ../sleep.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE Sleep(Nan::NAN_METHOD_ARGS_TYPE)’:
2020-11-17T13:47:33.925Z [err] ../sleep.cc:42:30: error: no matching function for call to ‘v8::Value::Uint32Value()’
2020-11-17T13:47:33.925Z [err] sleep(info[0]->Uint32Value());
2020-11-17T13:47:33.925Z [err] ^
2020-11-17T13:47:33.925Z [err] In file included from /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:67,
2020-11-17T13:47:33.925Z [err] from ../../nan/nan.h:56,
2020-11-17T13:47:33.925Z [err] from ../sleep.cc:2:
2020-11-17T13:47:33.925Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2707:41: note: candidate: ‘v8::Maybe v8::Value::Uint32Value(v8::Localv8::Context) const’
2020-11-17T13:47:33.925Z [err] V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
2020-11-17T13:47:33.925Z [err] ^~~~~~~~~~~
2020-11-17T13:47:33.925Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2707:41: note: candidate expects 1 argument, 0 provided
2020-11-17T13:47:33.925Z [err] ../sleep.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE USleep(Nan::NAN_METHOD_ARGS_TYPE)’:
2020-11-17T13:47:33.925Z [err] ../sleep.cc:54:31: error: no matching function for call to ‘v8::Value::Uint32Value()’
2020-11-17T13:47:33.925Z [err] usleep(info[0]->Uint32Value());
2020-11-17T13:47:33.925Z [err] ^
2020-11-17T13:47:33.925Z [err] In file included from /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:67,
2020-11-17T13:47:33.925Z [err] from ../../nan/nan.h:56,
2020-11-17T13:47:33.925Z [err] from ../sleep.cc:2:
2020-11-17T13:47:33.925Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2707:41: note: candidate: ‘v8::Maybe v8::Value::Uint32Value(v8::Localv8::Context) const’
2020-11-17T13:47:33.925Z [err] V8_WARN_UNUSED_RESULT Maybe<uint32_t> Uint32Value(
2020-11-17T13:47:33.925Z [err] ^~~~~~~~~~~
2020-11-17T13:47:33.925Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:2707:41: note: candidate expects 1 argument, 0 provided
2020-11-17T13:47:33.925Z [err] ../sleep.cc: In function ‘void init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
2020-11-17T13:47:33.925Z [err] ../sleep.cc:62:52: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
2020-11-17T13:47:33.925Z [err] Nan::New(Sleep)->GetFunction());
2020-11-17T13:47:33.925Z [err] ^
2020-11-17T13:47:33.926Z [err] In file included from /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:67,
2020-11-17T13:47:33.926Z [err] from ../../nan/nan.h:56,
2020-11-17T13:47:33.926Z [err] from ../sleep.cc:2:
2020-11-17T13:47:33.926Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:6126:46: note: candidate: ‘v8::MaybeLocalv8::Function v8::FunctionTemplate::GetFunction(v8::Localv8::Context)’
2020-11-17T13:47:33.926Z [err] V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
2020-11-17T13:47:33.926Z [err] ^~~~~~~~~~~
2020-11-17T13:47:33.926Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:6126:46: note: candidate expects 1 argument, 0 provided
2020-11-17T13:47:33.927Z [err] ../sleep.cc:64:53: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
2020-11-17T13:47:33.927Z [err] Nan::New(USleep)->GetFunction());
2020-11-17T13:47:33.927Z [err] ^
2020-11-17T13:47:33.927Z [err] In file included from /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:67,
2020-11-17T13:47:33.927Z [err] from ../../nan/nan.h:56,
2020-11-17T13:47:33.927Z [err] from ../sleep.cc:2:
2020-11-17T13:47:33.927Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:6126:46: note: candidate: ‘v8::MaybeLocalv8::Function v8::FunctionTemplate::GetFunction(v8::Localv8::Context)’
2020-11-17T13:47:33.927Z [err] V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
2020-11-17T13:47:33.927Z [err] ^~~~~~~~~~~
2020-11-17T13:47:33.927Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/v8.h:6126:46: note: candidate expects 1 argument, 0 provided
2020-11-17T13:47:33.928Z [err] In file included from ../../nan/nan.h:56,
2020-11-17T13:47:33.928Z [err] from ../sleep.cc:2:
2020-11-17T13:47:33.928Z [err] ../sleep.cc: At global scope:
2020-11-17T13:47:33.928Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:727:43: warning: cast between incompatible function types from ‘void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void ()(v8::Localv8::Object)’} to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void)’} [-Wcast-function-type]
2020-11-17T13:47:33.928Z [err] (node::addon_register_func) (regfunc),
2020-11-17T13:47:33.928Z [err] ^
2020-11-17T13:47:33.928Z [err] /home/pi/.cache/node-gyp/12.19.0/include/node/node.h:761:3: note: in expansion of macro ‘NODE_MODULE_X’
2020-11-17T13:47:33.928Z [err] NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
2020-11-17T13:47:33.928Z [err] ^~~~~~~~~~~~~
2020-11-17T13:47:33.928Z [err] ../sleep.cc:68:1: note: in expansion of macro ‘NODE_MODULE’
2020-11-17T13:47:33.928Z [err] NODE_MODULE(node_sleep, init)
2020-11-17T13:47:33.928Z [err] ^~~~~~~~~~~
2020-11-17T13:47:34.268Z [err] make: *** [node_sleep.target.mk:109: Release/obj.target/node_sleep/sleep.o] Error 1
2020-11-17T13:47:34.268Z [out] make: Leaving directory '/home/pi/.node-red/node_modules/sleep/build'
2020-11-17T13:47:34.271Z [err] gyp
2020-11-17T13:47:34.272Z [err]
2020-11-17T13:47:34.272Z [err] ERR! build error
2020-11-17T13:47:34.274Z [err] gyp
2020-11-17T13:47:34.274Z [err] ERR! stack Error: make failed with exit code: 2
2020-11-17T13:47:34.274Z [err] gyp
2020-11-17T13:47:34.274Z [err] ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
2020-11-17T13:47:34.274Z [err] gyp
2020-11-17T13:47:34.274Z [err] ERR! stack at ChildProcess.emit (events.js:314:20)
2020-11-17T13:47:34.274Z [err] gyp
2020-11-17T13:47:34.274Z [err] ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2020-11-17T13:47:34.275Z [err] gyp
2020-11-17T13:47:34.275Z [err] ERR! System Linux 5.4.72-v7l+
2020-11-17T13:47:34.275Z [err] gyp
2020-11-17T13:47:34.276Z [err] ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2020-11-17T13:47:34.276Z [err] gyp ERR!
2020-11-17T13:47:34.276Z [err] cwd /home/pi/.node-red/node_modules/sleep
2020-11-17T13:47:34.276Z [err] gyp
2020-11-17T13:47:34.276Z [err] ERR! node -v v12.19.0
2020-11-17T13:47:34.276Z [err] gyp ERR!
2020-11-17T13:47:34.276Z [err] node-gyp -v v5.1.0
2020-11-17T13:47:34.276Z [err] gyp ERR! not ok
2020-11-17T13:47:34.916Z [err] npm ERR! code ELIFECYCLE
2020-11-17T13:47:34.916Z [err] npm ERR! errno 1
2020-11-17T13:47:34.935Z [err] npm ERR! sleep@3.0.0 install: node-gyp rebuild
2020-11-17T13:47:34.935Z [err] npm ERR! Exit status 1
2020-11-17T13:47:34.935Z [err] npm ERR!
2020-11-17T13:47:34.935Z [err] npm ERR! Failed at the sleep@3.0.0 install script.
2020-11-17T13:47:34.935Z [err] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-11-17T13:47:34.953Z [err]
2020-11-17T13:47:34.954Z [err] npm
2020-11-17T13:47:34.964Z [err] ERR! A complete log of this run can be found in:
2020-11-17T13:47:34.964Z [err] npm ERR! /home/pi/.npm/_logs/2020-11-17T13_47_34_940Z-debug.log
2020-11-17T13:47:34.983Z rc=1:

and following the instruction row after row on the "node-red-contrib-mpu9250" it self....
thats what I was asked to do......

cd ~/.node-red
npm install /path/to/node-red-contrib-mpu9250

I suspect the node is not compatible with nodejs 12 which you have (or 14 which I have). You should submit an issue on the nodes gitlab page and hope the author responds promptly. In the meantime you could downgrade your system to nodejs 8 or 10 I suppose, but it might be a trivial fix so probably worth submitting the issue and waiting for 24 hours to see what happens.

Those are instructions on how to install if you have downloaded the source onto your system. Where is says path/to/ you are supposed to put the path to folder which you downloaded it to. Which you haven't and you don't need to.

Thanks Colin for your prompt respond. I will folllow your advice.
Yes, I tried to change the "path/to" with no better results

I am trying to read a GY-91 sensor connected to my RPI4, do you know of any other module able to use this sensor?

Thanks again.
Regards Andrea

As I said, that would only work if you had downloaded the node's source first, and if it won't build installing from node-red then it won't install directly from source either. It needs to be fixed.

I don't know anything about that sensor, sorry.

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