NPM error installing "sse4_crc32" - node.js

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
\
> sse4_crc32#3.3.0 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'

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).

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.

Related

`npx create-react-app my-app` is trying to use the wrong npm

I'm using a MacBook Pro.
I have a fresh install of nvm. I set the node version and it's set to 16.17.0 and npm -v and nix -v both show 8.15.0.
When I run npx create-react-app my-app it fails and the log shows the following...
info using npm#6.5.0
Where is this coming from, and how do I fix it?
I originally installed a number of recent and not-so-recent versions of node.js with Homebrew and I had the exact same error. I completely annihilated every instance of node.js and npm from /usr/bin and /usr/local/bin. There is nothing related in my $PATH, but there must be a reference somewhere.
Well, I played around and discovered that installing version 14.0.0 of node.js plays nicely and my app is now created... but I am now getting...
npm WARN npm npm does not support Node.js v14.0.0
I'm still confounded by the original error because I also tried with 12.0.0 and it tried to work and failed in a nice manner with an error that I could play along with. I'm still baffled by the original error.

Sorry, there's a problem with nodist. When trying to initilise a new npm project

I am following the following guide from GitHub Here but when I enter npm init I keep getting the error:
Sorry, there's a problem with nodist. Couldn't resolve node version
spec %s: %s 11.13.0 Couldn't find any matching version
I have followed the previous steps and set the version to v10.15.3, but the error keeps appearing every time I use nvm. I have also set the version to v11.13.0, as this is what the error is requesting, but I still get the same result. Installed versions include: 11.13.0, 10.16.0, 10.15.3, 8.11.2, 0.12.0
Any help with this would be much appreciated!
There are several reasons which can cause this problem:
If due to some reasons like poor internet connection your node or npm versions you have downloaded are corrupted. In this case you need to remove the files .npm-version-global and .node-version-global as well as empty the folders v, v-64 and npmv within the installation of the Nodist folder.
You have a local version of the node specified in .node-version file in the root directory of your project. In this case you need to install that version by nodist local XXX where XXX is the version of the node in .node-version file.
In my case, the problem was that I had a node version specified in my code repo that didn't match the node version installed on my machine. I needed the updated node version on my machine, so
I opened file explorer to the root of my repo.
I opened .node-version and edited the version number to the updated version I needed.
npm cache clean --force to start with a fresh cache. (Note: Others have said that npm cache clean --force is outdated, but this command worked for both my teammate and for me using npm version 6.9.0.)
npm install to reinstall my node modules.
npm run build and I had a clean build. Yay!
For Node 18 and npm 8.19.1, I found the advice at https://github.com/nullivex/nodist/issues/252#issuecomment-1170897428 useful.
I was getting cb.apply errors, and problems with #npmcli/arborist and libnpmfund, but I created those two links from the list.
I was using npx. This installs an old (v 5.8) version of npm inside its node_modules. That npm contains graceful-fs inside its node_modules. The cb.apply error was coming frome graceful-fs's polyfill.js.
I installed the latest version of graceful-fs, and copied the newer polyfill.js into the abovementioned (child of npm's) graceful-fs. This seemed to fix the problem for me.

Angular - Is node-sass supported in the node version 11?

I have this new error which is failing the compilation of the code.
Is it the problem with the node version?
Is node-sass supported in all node versions?
If not how to fix this?
Module build failed: Error: Cannot find module 'node-sass'
Try running npm rebuild node-sass and see if it fixes your problem (you may have to run with --force)
You should run this every time you change your environment (ie: node version).

How do I install gRPC for electron version 4.0.x

Installed electron#4.0.0 (also tried #4.0.7) and installed grpc and #grpc/proto-loader. When I launch electron I get a runtime error
Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: electron-v4.0-darwin-x64-unknown
Found: [node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Of course I tried running the suggested solution, npm rebuild, but that did not solve the problem. I also tried rebuilding the grpc module
npm rebuild grpc --build-from-source --runtime=electron --target=4.0.0 --target_archx64 --dturl=https://atom.io/download/electron
I tried uninstalling everything and starting from scratch. We're cloning the electron quick start repo and so after cloning and installing modules I installed grpc targeting a specific version
npm install grpc --runtime=electron --target=<electron version>
Which resulted in the same error so then I tried rebuilding
npm install --save-dev electron-rebuild // to rebuild grpc module
And if I delete node_modules and package-lock.json and then re-install npm install I get a success message (don't pay attention to the version, I'm watching my versions are matching) which looks like the "missing" module was installed
node-pre-gyp WARN Using request for node-pre-gyp https download
[grpc]
Success: "/../electron/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" is installed via remote
protobufjs#6.8.8 postinstall /../electron/node_modules/protobufjs
node scripts/postinstall
electron#4.0.8 postinstall /../electron/node_modules/electron
node install.js
I found the answer here:
https://github.com/grpc/grpc-node/issues/762
Still, the solution I tried is the solution I needed. Not sure what I was doing wrong initially!
For future Googlers the summary is this:
The grpc_node module seems to be compiled for NODE_MODULE_VERSION=64,
but Electron 4 since 4.0.4 switched ... to
specifying NODE_MODULE_VERSION=69 and there is a mismatch at runtime
trying to load the module.
So, what I did to solve was
Clone the electron quick start repo
Uninstall the version of electron that came with quick start
Install electron#4.0.0
Install gRPC with target to 4.0.0
npm install grpc --runtime=electron --target=4.0.0

Node-gyp rebuild Error

while trying to install node dependency(npm install) error Am using node version v4.4.0
It looks like you're using an older version of npm. You might want to get the latest by running npm install npm.
Contextify actually isn't needed since you're running Node version >4. I suspect that you haven't explicitly included contextify but rather it is being included as a dependency by some other package. Try to figure out what package that is and see if there's a newer version of it that. See here: https://github.com/nodejs/node-gyp/issues/785

Resources