Unable to install on macOS 11.4 Apple Silicon Node v16.4
See original GitHub issueHi. I get the errors as below when trying to npm install in the environment noted in the description. We have other systems running identical (as far as we can tell) OS and other dependencies, but on macOS for Intel, and they build the same project just fine. Wondering if there is something still not right with node-libcurl on Node v16 and Apple Silicon, even at node-libcurl 2.3.3. Have tried at Node v16.4.0 and v16.4.2 FWIW.
Here’s an extract from the log file:
1371 info run node-libcurl@2.3.3 install { code: 1, signal: null }
1372 info run fsevents@1.2.13 install { code: 0, signal: null }
1373 timing build:run:install:node_modules/fsevents Completed in 2043ms
1374 timing reify:rollback:createSparse Completed in 1585ms
1375 timing reify:rollback:retireShallow Completed in 1ms
1376 timing command:install Completed in 21734ms
1377 verbose stack Error: command failed
1377 verbose stack at ChildProcess.emit (node:events:394:28)
1377 verbose stack at maybeClose (node:internal/child_process:1067:16)
1377 verbose stack at Socket.<anonymous> (node:internal/child_process:453:11)
1377 verbose stack at Socket.emit (node:events:394:28)
1379 verbose cwd /Users/myname/GitHub/XC2-User-BE
1380 verbose Darwin 20.5.0
1382 verbose node v16.4.2
1383 verbose npm v7.18.1
1384 error code 1
1385 error path /Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl
1386 error command failed
1387 error command sh -c node-pre-gyp install --fallback-to-build
1389 error node-pre-gyp info it worked if it ends with ok
1389 error node-pre-gyp info using node-pre-gyp@0.15.0
1389 error node-pre-gyp info using node@16.4.2 | darwin | arm64
1389 error node-pre-gyp WARN Using request for node-pre-gyp https download
1389 error gyp info it worked if it ends with ok
1389 error gyp info using node-gyp@7.1.2
1389 error gyp info using node@16.4.2 | darwin | arm64
1389 error gyp info ok
1389 error (Use `node --trace-deprecation ...` to show where the warning was created)
1389 error gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
1389 error gyp info spawn args [
1389 error gyp info spawn args '/Users/myname/.nvm/versions/node/v16.4.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
1389 error gyp info spawn args '-I',
1389 error gyp info spawn args '/Users/myname/Library/Caches/node-gyp/16.4.2/include/node/common.gypi',
1389 error gyp info spawn args '-Dlibrary=shared_library',
1389 error gyp info spawn args '-Dnode_lib_file=/Users/myname/Library/Caches/node-gyp/16.4.2/<(target_arch)/node.lib',
1389 error gyp info spawn args '-Dmodule_root_dir=/Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl',
1389 error gyp info spawn args '-Dnode_engine=v8',
1389 error gyp info spawn args '--depth=.',
1389 error gyp info spawn args '--no-parallel',
1389 error gyp info spawn args '--generator-output',
1389 error gyp info spawn args 'build',
1389 error gyp info spawn args '-Goutput_dir=.'
1389 error gyp info spawn args ]
1389 error error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: /usr/lib/libcurl.dylib (No such file or directory)
1389 error gyp: Call to 'otool -D `curl-config --prefix`/lib/libcurl.dylib | sed -n 2p' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
1389 error gyp ERR! configure error
1389 error gyp ERR! stack Error: `gyp` failed with exit code: 1
1389 error gyp ERR! stack at ChildProcess.onCpExit (/Users/myname/.nvm/versions/node/v16.4.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
1389 error gyp ERR! stack at ChildProcess.emit (node:events:394:28)
1389 error gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
1389 error gyp ERR! System Darwin 20.5.0
1389 error gyp ERR! command "/Users/myname/.nvm/versions/node/v16.4.2/bin/node" "/Users/myname/.nvm/versions/node/v16.4.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl/lib/binding/node_libcurl.node" "--module_name=node_libcurl" "--module_path=/Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
1389 error gyp ERR! cwd /Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl
1389 error gyp ERR! node -v v16.4.2
1389 error gyp ERR! node-gyp -v v7.1.2
1389 error gyp ERR! not ok
1389 error node-pre-gyp ERR! build error
1389 error node-pre-gyp ERR! stack Error: Failed to execute '/Users/myname/.nvm/versions/node/v16.4.2/bin/node /Users/myname/.nvm/versions/node/v16.4.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
1389 error node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/myname/GitHub/XC2-User-BE/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
1389 error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:394:28)
1389 error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
1389 error node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
1389 error node-pre-gyp ERR! System Darwin 20.5.0
1389 error node-pre-gyp ERR! command "/Users/myname/.nvm/versions/node/v16.4.2/bin/node" "/Users/myname/GitHub/XC2-User-BE/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
1389 error node-pre-gyp ERR! cwd /Users/myname/GitHub/XC2-User-BE/node_modules/node-libcurl
1389 error node-pre-gyp ERR! node -v v16.4.2
1389 error node-pre-gyp ERR! node-pre-gyp -v v0.15.0
1389 error node-pre-gyp ERR! not ok
1390 verbose exit 1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top Results From Across the Web
nvm install node fails to install on macOS Big Sur M1 Chip
If you have installed nvm using homebrew and are trying to install the node using command nvm install <some_version> , you will face...
Read more >If an error occurred while updating or installing macOS
The message might say that an error occurred while downloading, preparing, or installing, or that the installer is damaged or could not be ......
Read more >Installing Node.js via package manager
fnm has cross-platform support (macOS, Windows, Linux) & all popular shells (Bash, Zsh, Fish, PowerShell, Windows Command Line Prompt). fnm is built with...
Read more >How to Install NVM and Node on macOS M1 Silicon in 2022
If you're a software engineer with a Mac, having NVM and Node installed is likely a requirement. In 2022, it's easier than ever...
Read more >macOS Big Sur: How to setup Node.js on Apple M1 Machine
Sometimes you still need to work on x64 architecture. Most likely because some of the libraries or npm packages that you are using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

OK I think I am past this issue. Regarding both traces above:
First trace:
Second trace:
brew install curl-opensslexport PATH="/opt/homebrew/opt/curl/bin:$PATH" >> ~/.zshrcJust noting that this worked for me again on another M1 Mac, and on macOS 12.0.1, from the same error message. I know this shouldn’t be surprising, but it is alway pleasing nonetheless.