Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-gyp fails on Sonoma with CLI only and not XCode (Mac M1 / Apple Silicon) #2992

Closed
GeoffreyPlitt opened this issue Mar 12, 2024 · 19 comments
Labels

Comments

@GeoffreyPlitt
Copy link

GeoffreyPlitt commented Mar 12, 2024

node-gyp fails on Sonoma with CLI only and not XCode (Mac M1 / Apple Silicon)

At https://github.com/nodejs/node-gyp/blob/main/gyp/pylib/gyp/xcode_emulation.py#L1496C41-L1496C51 it appears to be looking for version numbers at the end of the "xcodebuild -version" command. But for me, that command does not produce version numbers, see below

The code seems to describe itself working well even if the box only has CLI tools and not full Xcode, but that doesn't seem to be the case in reality:

$ uname -a Darwin Geoffs-Mac-mini.local 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:06 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T8103 arm64 (base)

$ xcodebuild -version xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Mac M1 / Sonoma 14.4

@cclauss
Copy link
Contributor

cclauss commented Mar 12, 2024

A full error log would be extremely helpful.

It would be super helpful if we all could see what you are seeing. Would it be possible to create a GitHub Action to show everyone what happens?

If you use os: [macos-14] your GitHub Action will run on an M1 Mac.

@cclauss
Copy link
Contributor

cclauss commented Mar 12, 2024

Please try: NODE_GYP_FORCE_PYTHON=python3 <your command goes here>

@cclauss cclauss added the macOS label Mar 12, 2024
@GeoffreyPlitt
Copy link
Author

GeoffreyPlitt commented Mar 12, 2024

@cclauss Thanks for the ideas! I will try the github action shortly. In the meantime, I tried your env var, did not alter the result much:

$ export NODE_GYP_FORCE_PYTHON=python3
$ echo $NODE_GYP_FORCE_PYTHON
python3
$ pnpm install

Lockfile is up to date, resolution step is skipped
Packages: +400 -168
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------
Progress: resolved 385, reused 383, downloaded 0, added 0, done
node_modules/.pnpm/[email protected]/node_modules/pprof: Running install script, failed in 1.1s
.../.pnpm/[email protected]/node_modules/pprof install$ node-pre-gyp install --fallback-to-build
│ node-pre-gyp info it worked if it ends with ok
│ node-pre-gyp info using [email protected]
│ node-pre-gyp info using [email protected] | darwin | arm64
│ node-pre-gyp info check checked for "/Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/pprof/build/node-v108-darwin-arm64-unknown/pprof.node" (not fo…
│ node-pre-gyp http GET https://storage.googleapis.com/cloud-profiler/pprof-nodejs/release/v3.2.1/node-v108-darwin-arm64-unknown.tar.gz
│ node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/cloud-profiler/pprof-nodejs/release/v3.2.1/node-v108-darwin-arm64-unknown.tar.gz 
│ node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, unknown) (falling back to source compile with node-gyp) 
│ node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/cloud-profiler/pprof-nodejs/release/v3.2.1/node-v108-darwin-arm64-unknown.tar.gz 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | arm64
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | arm64
│ gyp info find Python using Python version 3.11.4 found at "/Users/giro/miniconda3/bin/python3"
│ gyp info spawn /Users/giro/miniconda3/bin/python3
│ gyp info spawn args [
│ gyp info spawn args   '/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'make',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/pprof/build/config.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/giro/Library/Caches/node-gyp/18.18.2/include/node/common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=/Users/giro/Library/Caches/node-gyp/18.18.2',
│ gyp info spawn args   '-Dnode_gyp_dir=/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp',
│ gyp info spawn args   '-Dnode_lib_file=/Users/giro/Library/Caches/node-gyp/18.18.2/<(target_arch)/node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=/Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/pprof',
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'build',
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
│ No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
│ No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
│ Traceback (most recent call last):
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1502, in XcodeVersion
│     version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines()
│                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1563, in GetStdoutQuiet
│     raise GypError("Error %d running %s" % (job.returncode, cmdlist[0]))
│ gyp.common.GypError: Error 1 running xcodebuild
│ During handling of the above exception, another exception occurred:
│ Traceback (most recent call last):
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py", line 45, in <module>
│     sys.exit(gyp.script_main())
│              ^^^^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 686, in script_main
│     return main(sys.argv[1:])
│            ^^^^^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 678, in main
│     return gyp_main(args)
│            ^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 663, in gyp_main
│     generator.GenerateOutput(flat_list, targets, data, params)
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2651, in GenerateOutput
│     writer.Write(
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 902, in Write
│     self.WriteCopies(spec["copies"], extra_outputs, part_of_all)
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1298, in WriteCopies
│     env = self.GetSortedXcodeEnv()
│           ^^^^^^^^^^^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2269, in GetSortedXcodeEnv
│     return gyp.xcode_emulation.GetSortedXcodeEnv(
│            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1888, in GetSortedXcodeEnv
│     env = _GetXcodeEnv(
│           ^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1743, in _GetXcodeEnv
│     "XCODE_VERSION_ACTUAL": XcodeVersion()[0],
│                             ^^^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1513, in XcodeVersion
│     version = CLTVersion()  # macOS Catalina returns 11.0.0.0.1.1567737322
│               ^^^^^^^^^^^^
│   File "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1551, in CLTVersion
│     return re.search(regex, output).groupdict()["version"]
│            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│ AttributeError: 'NoneType' object has no attribute 'groupdict'
│ gyp ERR! configure error 
│ gyp ERR! stack Error: `gyp` failed with exit code: 1
│ gyp ERR! stack     at ChildProcess.onCpExit (/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/lib/configure.js:325:16)
│ gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
│ gyp ERR! System Darwin 23.4.0
│ gyp ERR! command "/Users/giro/Library/pnpm/nodejs/18.18.2/bin/node" "/Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "c…
│ gyp ERR! cwd /Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/pprof
│ gyp ERR! node -v v18.18.2
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok 
│ node-pre-gyp ERR! build error 
│ node-pre-gyp ERR! stack Error: Failed to execute '/Users/giro/Library/pnpm/nodejs/18.18.2/bin/node /Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_module…
│ node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/@[email protected]/node_modules/@mapbox/node-pre-gyp/lib/u…
│ node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
│ node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
│ node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
│ node-pre-gyp ERR! System Darwin 23.4.0
│ node-pre-gyp ERR! command "/Users/giro/Library/pnpm/nodejs/18.18.2/bin/node" "/Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/@mapbox/node-pre-gyp/…
│ node-pre-gyp ERR! cwd /Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/pprof
│ node-pre-gyp ERR! node -v v18.18.2
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.11
│ node-pre-gyp ERR! not ok 
│ Failed to execute '/Users/giro/Library/pnpm/nodejs/18.18.2/bin/node /Users/giro/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js conf…
└─ Failed in 1.1s at /Users/giro/auditboard-dev-env/soxhub-api/node_modules/.pnpm/[email protected]/node_modules/pprof
 ELIFECYCLE  Command failed with exit code 1.

@GeoffreyPlitt
Copy link
Author

@cclauss I created a PR based on a fork here with a new GHA action, can you approve? It says the action needs approval to run.
#2993

@cclauss
Copy link
Contributor

cclauss commented Mar 12, 2024

Single backticks ` in markdown are for one line only.

Use triple backticks for multiline strings.

@GeoffreyPlitt
Copy link
Author

GeoffreyPlitt commented Mar 13, 2024

Hi guys, the action I created (assuming I created it correctly?) seems to point to a bug where a Windows path is being used on Mac: #2993

@cclauss
Copy link
Contributor

cclauss commented Mar 13, 2024

Agreed. Is this a runtime problem or just a test time problem?

@GeoffreyPlitt
Copy link
Author

@cclauss Install-time. My pnpm install does not complete successfully.

@v29neil
Copy link

v29neil commented Apr 4, 2024

Facing same issue , when running yarn add npm-check-updates
Node - v20.11.1
npm - v10.5.1
Sonoma OS

error /Users/v29neil/Office/SaveSageTools/node_modules/argon2: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: /Users/v29neil/Office/SaveSageTools/node_modules/argon2
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | arm64
node-pre-gyp info check checked for "/Users/v29neil/Office/SaveSageTools/node_modules/argon2/lib/binding/napi-v3/argon2.node" (not found)
node-pre-gyp http GET https://github.com/ranisalt/node-argon2/releases/download/v0.28.7/argon2-v0.28.7-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.28.7/argon2-v0.28.7-napi-v3-darwin-arm64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v115 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.28.7/argon2-v0.28.7-napi-v3-darwin-arm64-unknown.tar.gz 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.12.2 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
gyp info spawn args [
gyp info spawn args   '/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/v29neil/Office/SaveSageTools/node_modules/argon2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/v29neil/Library/Caches/node-gyp/20.11.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/v29neil/Library/Caches/node-gyp/20.11.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/v29neil/Library/Caches/node-gyp/20.11.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/v29neil/Office/SaveSageTools/node_modules/argon2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Darwin 23.4.0
gyp ERR! command "/Users/v29neil/.nvm/versions/node/v20.11.1/bin/node" "/Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/v29neil/Office/SaveSageTools/node_modules/argon2/lib/binding/napi-v3/argon2.node" "--module_name=argon2" "--module_path=/Users/v29neil/Office/SaveSageTools/node_modules/argon2/lib/binding/napi-v3" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /Users/v29neil/Office/SaveSageTools/node_modules/argon2
gyp ERR! node -v v20.11.1
gyp ERR! node-gyp -v v9.4.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/v29neil/.nvm/versions/node/v20.11.1/bin/node /Users/v29neil/Office/SaveSageTools/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/v29neil/Office/SaveSageTools/node_modules/argon2/lib/binding/napi-v3/argon2.node --module_name=argon2 --module_path=/Users/v29neil/Office/SaveSageTools/node_modules/argon2/lib/binding/napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/v29neil/Office/SaveSageTools/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
node-pre-gyp ERR! System Darwin 23.4.0
node-pre-gyp ERR! command "/Users/v29neil/.nvm/versions/node/v20.11.1/bin/node" "/Users/v29neil/Office/SaveSageTools/node_modules/argon2/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/v29neil/Office/SaveSageTools/node_modules/argon2
node-pre-gyp ERR! node -v v20.11.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok

@cclauss
Copy link
Contributor

cclauss commented Apr 4, 2024

gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.12.2

Python 3.12 requires node-gyp >= v10.

Upgrade to node-gyp@10 or downgrade to [email protected].

@cclauss
Copy link
Contributor

cclauss commented Apr 11, 2024

Can you do this without node-pre-gyp?

@cclauss
Copy link
Contributor

cclauss commented Apr 23, 2024

@GeoffreyPlitt Now that we have a macOS ARM GitHub Action in place, is it possible to modify it (add pnpm?, add node-pre-commit?, add both?`) to replicate your config and make the tests fail?

https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#tools

@GeoffreyPlitt
Copy link
Author

@cclauss Can you explain more what you mean? I'll help if I can.

I saw that #2993 is closed, did it get resolved?

@cclauss
Copy link
Contributor

cclauss commented Apr 24, 2024

Added a GitHub Action on MacOS ARM64 Apple Silicon test which closed #2993

- os: macos-14
python: "3.12"
node: 20.x

I do not believe that solves this problem. It might offer a way to replicate the problem in our GitHub Actions so that everyone can see the failure.

Is it possible to modify .github/workflows/tests.yml (add pnpm?, add node-pre-commit?, add both?) to replicate your config and make the tests fail?

@GeoffreyPlitt
Copy link
Author

Shoot, it's been 1.5 months and I can't remember how I first encountered this bug, to be honest. I know it was during pnpm install for my employer's project, but at some point I found a workaround or something and haven't seen it for a while.

@cclauss cclauss closed this as completed May 1, 2024
@ToshihitoKon
Copy link

FYI:
I encountered the same problem and found a solution in node-gyp 9.x.

pip3 install setuptools

I don't know why it works, but it resolved.

node-gyp: v9.4.1
OS: M1 MacOS Sonoma 14.4.1
Python: v3.12.1
Node: v20.11.1

@MeirP-3
Copy link

MeirP-3 commented Jun 24, 2024

MacOS Sonoma 14.5 failed npm install canvas.

After digging in the error log, root cause were errors similar to error <cstddef> tried including <stddef.h> but didn't find libc++'s <stddef.h> header..

Solution was:

export SDKROOT=$(xcrun --show-sdk-path)
npm install canvas

@linhaosunny
Copy link

linhaosunny commented Aug 28, 2024

so, it's solves this problem?, i can't found what usefull solutions, and why it be closed?
I try all guys sayed, but it not work, I still have the issue.

@linhaosunny
Copy link

so, it's solves this problem?, i can't found what usefull solutions, and why it be closed? I try all guys sayed, but it not work, I still have the issue.

npm WARN deprecated [email protected]: Issues and pull requests filed against this version are not supported. See the React Native release support policy to learn more: https://github.com/reactwg/react-native-releases#releases-support-policy
npm ERR! code 1
npm ERR! path /Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c
npm ERR! Failed to execute '/opt/homebrew/Cellar/node/21.7.1/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64 --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v120' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | darwin | arm64
npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64/node_sqlite3.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v120-darwin-arm64.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v120-darwin-arm64.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v120-darwin-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v120 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v120-darwin-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.5 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/danxiao/Library/Caches/node-gyp/21.7.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/danxiao/Library/Caches/node-gyp/21.7.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/danxiao/Library/Caches/node-gyp/21.7.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! /bin/sh: python: command not found
npm ERR! make: *** [Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: make failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess. (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 23.1.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/21.7.1/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v120"
npm ERR! gyp ERR! cwd /Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3
npm ERR! gyp ERR! node -v v21.7.1
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node/21.7.1/bin/node /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3/lib/binding/node-v120-darwin-arm64 --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v120' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! node-pre-gyp ERR! System Darwin 23.1.0
npm ERR! node-pre-gyp ERR! command "/opt/homebrew/Cellar/node/21.7.1/bin/node" "/Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/danxiao/Desktop/LeeGithub/ghostery/user-agent-ios/node_modules/sqlite3
npm ERR! node-pre-gyp ERR! node -v v21.7.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/danxiao/.npm/_logs/2024-08-28T03_49_26_755Z-debug-0.log

@cclauss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants