awslabs / harmonix

A developer portal to meet your Enterprise needs. Fast, secure, and at-scale.
https://harmonixonaws.io/
Apache License 2.0
207 stars 42 forks source link

node-gyp error on install #112

Closed awsandy closed 1 month ago

awsandy commented 1 month ago

Having trouble building this on MacOS:

Have anyone else seen this ?

$ make install

..........

LIBTOOL-STATIC Release/cpu_features.a CXX(target) Release/obj.target/cpufeatures/src/binding.o In file included from ../src/binding.cc:1: In file included from /Users/awsandy/Library/Caches/node-gyp/20.17.0/include/node/node.h:73: /Users/awsandy/Library/Caches/node-gyp/20.17.0/include/node/v8.h:21:10: fatal error: 'memory' file not found 21 | #include | ^~~~ 1 error generated. make[2]: [Release/obj.target/cpufeatures/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 (/Users/awsandy/odp/AWS/sw/Harmonix/harmonix/backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js:203:23) gyp ERR! stack at ChildProcess.emit (node:events:519:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) gyp ERR! System Darwin 23.6.0 gyp ERR! command \"/usr/local/bin/node\" \"/Users/awsandy/odp/AWS/sw/Harmonix/harmonix/backstage/node_modules/.bin/node-gyp\" \"rebuild\" gyp ERR! cwd /Users/awsandy/odp/AWS/sw/Harmonix/harmonix/backstage/node_modules/cpu-features gyp ERR! node -v v20.17.0 gyp ERR! node-gyp -v v9.4.1 gyp ERR! not ok" info This module is OPTIONAL, you can safely ignore this error make[1]: [backstage-install] Error 1 make: *** [install] Error 2


uname -a Darwin bcd0749e47ec 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

node --version v20.17.0

Did this as others reported it might be relevant - but no joy xcode-select --install xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates

acwatson commented 1 month ago

Hi. We have seen some node-gyp issues before on various Linux distributions. I can't reproduce your issue specifically but here is some advice given by bnoordhuis at https://github.com/nodejs/node-gyp/issues/1273

"memory is a system header. If the compiler can't find it, make sure you have Xcode or Command Line Tools installed and select an SDK with xcode-select."

You are responsible for what you do to your Mac, but bnoordhuis's advice seems promising.

chbomtempo commented 1 month ago

I'm having the same problem after upgrading to Mac 14.7. It was working fine on 14.6.1

awsandy commented 1 month ago

I'd seen https://github.com/nodejs/node-gyp/issues/1273 - and tried that, but it didn't help. (I'm on 14.6.1 currently)

I'll try a build on AML2023 next I think.

z-sourcecode commented 1 month ago

Hi @awsandy and @chbomtempo I can confirm no issues with Mac 14.6.1 -> once upgraded to 14.7 we will update the status for that version.

We have automated process to check every release on a clean installation, we can confirm there's no issues installing/deploying harmonix using ubuntu:22.04 --> LINUX aws/codebuild/standard:6.0 https://github.com/aws/aws-codebuild-docker-images/tree/master/ubuntu/standard/6.0 Can you please try to using that and let us know if you encounter any issues. Thanks.

awsjim commented 1 month ago

@awsandy - the version of node-gyp shown in your output (v9.4.1) is an older release.
During the make backstage-install target, Backstage is installed via Backstage's "create-app" utility. Based on the content of the package.json used by this process, node-gyp should be v10.0.0 or higher (v10.2.0 is the latest) for the local install.

Can you run the following commands and provide the output?

awsandy commented 1 month ago

Hi,

Thanks for looking into this, as requested:

$ npm ls -g /usr/local/lib ├── corepack@0.29.3 └── npm@10.8.2

$ node-gyp -v zsh: command not found: node-gyp

$ ./backstage/node_modules/.bin/node-gyp -v v9.4.1

$ which python
/Users/awsandy/.pyenv/shims/python

$ python -V
Python 3.9.16

chbomtempo commented 1 month ago

@awsandy I was able to fix it by

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcode-select -r

Then restart the mac. On my next try it worked.

awsandy commented 1 month ago

Yes - @chbomtempo - that did the trick for me too!

Thank you