agam
agam

Reputation: 5384

NPM error installing "sse4_crc32"

I was initially getting this error as a dependency for a different package, but it fails when I try it on its own too. Since it's the first time I'm trying to install a node.js package, I'm sure I'm missing something, but what?

$ npm install --save sse4_crc32
\
> [email protected] install /home/agam/node_modules/sse4_crc32
> node-gyp rebuild

make: Entering directory '/home/agam/node_modules/sse4_crc32/build'
  CXX(target) Release/obj.target/sse4_crc32/src/sse4_crc32.o
In file included from ../src/sse4_crc32.cpp:18:0:
../node_modules/nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local)’:
../node_modules/nan/nan.h:1178:27: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
                           v8::String::REPLACE_INVALID_UTF8;
                           ^
sse4_crc32.target.mk:87: recipe for target 'Release/obj.target/sse4_crc32/src/sse4_crc32.o' failed
make: *** [Release/obj.target/sse4_crc32/src/sse4_crc32.o] Error 1
make: Leaving directory '/home/agam/node_modules/sse4_crc32/build'

Upvotes: 4

Views: 2092

Answers (2)

Ronald Moetwil
Ronald Moetwil

Reputation: 46

Ran into the same issue today.

I was on Node 0.10.29 which supposedly should work. Upgraded to Node 0.10.38 but that didn't solve the problem.

I was running on debian (jessy) and there npm was installed pulling in a old version of node-gyp as a dependency. 0.2.0 I believe for npm 1.4.x.

Installing a new version of node-gyp through npm install -g solved the problem. (After some symlink changes to point to the new node-gyp).

Upvotes: 3

mscdex
mscdex

Reputation: 106736

My guess is you're using node v0.11.12 or an earlier v0.11 release which would not have v8::String::REPLACE_INVALID_UTF8 (which is available since v0.11.13 when v8 was upgraded to 3.24.x from 3.22.x). node v0.11.x versions are considered unstable and you should upgrade to at least v0.12. After that, the error should go away.

The more technical reason for the error is that nan simply does a check if the node ABI version is post-v0.10 around the code that uses v8::String::REPLACE_INVALID_UTF8, so it assumes you're using v0.12 or newer, where that constant is available.

Upvotes: 3

Related Questions