nodejs / node-gyp

Node.js native addon build tool
MIT License
9.87k stars 1.79k forks source link

M2 yarn install failed? #3002

Closed xieyezi closed 6 months ago

xieyezi commented 6 months ago
Verbose output (from npm or node-gyp): ``` (base) ➜ pietra-landing-pages git:(master) yarn yarn install v1.22.21 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... warning " > react-fade-in@2.0.1" has incorrect peer dependency "react@^16.8 || 17". warning " > redux-persist@6.0.0" has unmet peer dependency "redux@>4.0.0". warning " > slick-carousel@1.8.1" has unmet peer dependency "jquery@>=1.8.0". warning " > @graphql-codegen/typescript-react-apollo@4.3.0" has unmet peer dependency "graphql-tag@^2.0.0". warning "graphql-cli > graphql-config@3.0.3" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0". warning "graphql-cli > @graphql-cli/common > @graphql-tools/load@6.2.4" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/graphql-file-loader@6.2.7" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/json-file-loader@6.2.6" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/load@6.2.8" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/merge@6.2.17" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/url-loader@6.10.1" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/utils@6.2.4" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/graphql-file-loader > @graphql-tools/utils@7.10.0" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/merge > @graphql-tools/utils@8.0.2" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/url-loader > @graphql-tools/delegate@7.1.5" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/url-loader > @graphql-tools/wrap@7.0.8" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/url-loader > graphql-ws@4.9.0" has incorrect peer dependency "graphql@>=0.11 <=15". warning "graphql-cli > graphql-config > @graphql-tools/url-loader > @graphql-tools/delegate > @graphql-tools/batch-execute@7.1.2" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning "graphql-cli > graphql-config > @graphql-tools/url-loader > @graphql-tools/delegate > @graphql-tools/schema@7.1.5" has incorrect peer dependency "graphql@^14.0.0 || ^15.0.0". warning " > less-loader@11.1.3" has unmet peer dependency "webpack@^5.0.0". [4/4] 🔨 Building fresh packages... [1/2] ⠂ isolated-vm error /Users/xieyezi/parsec/piretra/pietra-landing-pages/node_modules/isolated-vm: Command failed. Exit code: 1 Command: prebuild-install || (node-gyp rebuild --release -j max && node-gyp clean) Arguments: Directory: /Users/xieyezi/parsec/piretra/pietra-landing-pages/node_modules/isolated-vm Output: prebuild-install warn install No prebuilt binaries found (target=18.19.1 runtime=node arch=arm64 libc= platform=darwin) gyp info it worked if it ends with ok gyp info using node-gyp@10.0.1 gyp info using node@18.19.1 | darwin | arm64 gyp info find Python using Python version 3.12.2 found at "/opt/homebrew/opt/python@3.12/bin/python3.12" gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12 gyp info spawn args [ gyp info spawn args '/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/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/xieyezi/parsec/piretra/pietra-landing-pages/node_modules/isolated-vm/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/xieyezi/Library/Caches/node-gyp/18.19.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/xieyezi/Library/Caches/node-gyp/18.19.1', gyp info spawn args '-Dnode_gyp_dir=/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/Users/xieyezi/Library/Caches/node-gyp/18.19.1/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/xieyezi/parsec/piretra/pietra-landing-pages/node_modules/isolated-vm', 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/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1496, in XcodeVersion version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1557, 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/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 45, in sys.exit(gyp.script_main()) ^^^^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 688, in script_main return main(sys.argv[1:]) ^^^^^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 680, in main return gyp_main(args) ^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 665, in gyp_main generator.GenerateOutput(flat_list, targets, data, params) File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2648, in GenerateOutput writer.Write( File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 899, in Write self.WriteCopies(spec["copies"], extra_outputs, part_of_all) File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1295, in WriteCopies env = self.GetSortedXcodeEnv() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2266, in GetSortedXcodeEnv return gyp.xcode_emulation.GetSortedXcodeEnv( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1882, in GetSortedXcodeEnv env = _GetXcodeEnv( ^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1737, in _GetXcodeEnv "XCODE_VERSION_ACTUAL": XcodeVersion()[0], ^^^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1507, in XcodeVersion version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322 ^^^^^^^^^^^^ File "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1545, 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. (/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:271:18) 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.0.0 gyp ERR! command "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/bin/node" "/Users/xieyezi/Library/Application Support/fnm/node-versions/v18.19.1/installation/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" "-j" "max" gyp ERR! cwd /Users/xieyezi/parsec/piretra/pietra-landing-pages/node_modules/isolated-vm gyp ERR! node -v v18.19.1 gyp ERR! node-gyp -v v10.0.1 gyp ERR! not ok ```
xieyezi commented 6 months ago

I have confirmed that I have executed commands like "rm -rf node_modules," "yarn cache clean," deleted "yarn.lock," and re-executed "yarn install," but I still encounter this issue.

cclauss commented 6 months ago

xcode-select: note: No developer tools were found, requesting install.

Install them as discussed in README.md.

xieyezi commented 6 months ago

I have already solved this issue, but I am not sure exactly how I did it. Here are the steps I took:

  1. Deleted node_modules.
  2. run yarn cache clean.
  3. Switched to a higher version of Node, such as 21.4.0.
  4. Reinstalled Python via brew.
  5. Reinstalled Xcode command line tools.
  6. Updated node-gyp as per the instructions in the node-gyp documentation: https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md.
  7. run yarn install
cclauss commented 6 months ago

Step 5 was the key.