bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

Can't install Bedrock due to node-gyp errors

Open netsensei opened this issue 3 years ago • 2 comments

Hi!

I'm trying to set up Bedrock per the installation instructions, but npm install is failing with this error message:

> [email protected] install /home/netsensei/Workspace/my-bedrock-project/node_modules/ttf2woff2
> (node-gyp rebuild > builderror.log) || (exit 0)
                                                                               
../csrc/addon.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE convert(Nan::NAN_METHOD_ARGS_TYPE)’:                                                                                                                                                                                                                               
../csrc/addon.cc:10:48: error: no matching function for call to ‘v8::Value::ToObject()’
   10 |   Local<Object> inputBuffer = info[0]->ToObject();
      |                               ~~~~~~~~~~~~~~~~~^~
In file included from /home/netsensei/.cache/node-gyp/14.15.0/include/node/node.h:67,
                 from ../../nan/nan.h:56,
                 from ../csrc/addon.cc:1:
/home/netsensei/.cache/node-gyp/14.15.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/netsensei/.cache/node-gyp/14.15.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
make: *** [addon.target.mk:137: Release/obj.target/addon/csrc/addon.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/netsensei/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.15.16-100.fc34.x86_64
gyp ERR! command "/home/netsensei/.nvm/versions/node/v14.15.0/bin/node" "/home/netsensei/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/netsensei/Workspace/my-bedrock-project/node_modules/ttf2woff2
gyp ERR! node -v v14.15.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

Steps to reproduce

I'm on Fedora 34. But I've also tried this inside a Docker container based off node:14 (node v14.19.0) and on Vercel as well. In all instances, I'm ending up with the above failure.

  1. I'm using nvm so I've installed v14.15.0 per the .nvmrc file: nvm install v14.15.0
  2. npx degit usebedrock/bedrock my-bedrock-project
  3. cd my-bedrock-project
  4. npm instal => failure

I've also tried using different Node versions (15, 16) but to no avail.

We have an prototype based on an earlier version of Bedrock (v1.28) which yields the exact same error at this moment. So, we currently can't run this as well.

Any ideas on what's going wrong here? Thanks!

netsensei avatar Feb 03 '22 10:02 netsensei

Okay, I've narrowed this down. This is caused by issues with outdated dependencies in package-lock.json. When I delete the file, and just do npm install. Everything gets installed correctly.

Unrelated:

As for the prototype, there's a package called webfonts-generator in package.json which is the culprit, and triggers the above error as it tries to install an older version of node-gyp (3.8.0) which is incompatible with node 14.

Try this

nvm use v14.15.0
mkdir foobar && cd foobar
npm init
npm install webfonts-generator  # breaks

Edit: turns out icon-fonts-generator in our project isn't supported anymore because of this issue: https://github.com/Workshape/icon-font-generator/issues/73 Strange that it only pops up now.

edit2: I've solved the issue in our prototype project with icon-fonts-generator by swapping it for fantasticon.

netsensei avatar Feb 03 '22 11:02 netsensei

Thanks for reporting this, glad you could solve the issue!

Wolfr avatar Feb 03 '22 17:02 Wolfr