Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install failing saying "no member named isNearDeath"

Tags:

node.js

npm

I have to say my knowledge of npm or nvm are very limited.

I currently cloned a project that I need to run.

name a npm install and worked fine, was able to run it with npm run

That was a week ago. Today I wanted to run it again and started to see multiple weird errors.

like:

Module build failed: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (59)

which seems to be very popular, so popular that it has multiple possible answers.

it kinda "worked" the solution where I remove the package and I install one with a newer version. Taken from here (https://dev.to/letsbsocial1/node-sass-and-node-910-4ol) (plus I deleted the folders bower_components and node_modules)

Anyways, the npm install command is still failing, now due a weirder error.

                      ^
14 warnings and 9 errors generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0

and before of that I can see something like this:

In file included from ../src/binding.cpp:1:
In file included from ../../nan/nan.h:2222:
../../nan/nan_object_wrap.h:124:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(wrap->handle_.IsNearDeath());

Coming from a java world these errors make no sense and I am not able to figure out what is going on.

Any of you have an idea what I can do to make it run?

I am running

npm 6.9.0
node v12.6.0
like image 373
jpganz18 Avatar asked Jul 30 '19 12:07

jpganz18


People also ask

Why npm install is failing?

code 1 error usually occurs when you run the npm install command. This cause of this error is that one of the dependencies you define in your package. json file fails to be installed properly on your computer. This means that npm fails to install the node-sass module that's added as a dependency to the n-app project.


2 Answers

node-sass is a 'native' module (i.e. some parts of it are implemented in a language that compiles down to machine code - in this case, C++). This means that it makes use of Node's native APIs, which can change from version to version. As such, native modules will often only work with certain versions of Node, and require updates when the version of Node changes.

node-sass is no exception to this rule, and their README states that if you wish to use Node v12, you must use node-sass v4.12.0 or higher.

like image 70
Joe Clay Avatar answered Sep 26 '22 08:09

Joe Clay


I had a similar issue and it could be due to a Node upgrade: in fact I was able to solve it by downgrading from version 12 to 10, as discussed in this thread.

like image 40
Emanuele Bellini Avatar answered Sep 26 '22 08:09

Emanuele Bellini