Shopify / homebrew-shopify

47 stars 24 forks source link

npm ERR! when installing shopify cli #452

Open brentvanholder opened 1 year ago

brentvanholder commented 1 year ago

Hi, when installing the latest shopify-cli with the brew command brew install shopify-cli, the following error appears: Any ideas on how to solve it?

==> Downloading https://registry.npmjs.org/@shopify/theme/-/theme-3.25.0.tgz
Already downloaded: /Users/brent/Library/Caches/Homebrew/downloads/ce32944df809c6039786a25508cc0d01d4d9cd0c9f589f2f8191393988dc1058--theme-3.25.0.tgz
==> Downloading https://registry.npmjs.org/@shopify/cli/-/cli-3.25.0.tgz
Already downloaded: /Users/brent/Library/Caches/Homebrew/downloads/8998e461ceabd1b689c23a2a9bf1195c80640cf238a2edae230d5b5b39330a8d--cli-3.25.0.tgz
==> Installing shopify-cli from shopify/shopify
==> npm install -ddd --global --build-from-source --cache=/Users/brent/Library/Caches/Homebrew/npm_cache --prefix=/opt/h
Last 15 lines from /Users/brent/Library/Logs/Homebrew/shopify-cli/01.npm:
npm ERR! npm verb exit 1
npm ERR! npm timing npm Completed in 2492ms
npm ERR! npm verb code 1
npm verb exit 1
npm timing npm Completed in 6322ms
npm verb unfinished npm timer reify 1670838496491
npm verb unfinished npm timer reify:build 1670838498899
npm verb unfinished npm timer build 1670838498899
npm verb unfinished npm timer build:deps 1670838498899
npm verb unfinished npm timer build:run:install 1670838499132
npm verb unfinished npm timer build:run:install:node_modules/@shopify/cli/node_modules/keytar 1670838499132
npm verb code 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brent/Library/Caches/Homebrew/npm_cache/_logs/2022-12-12T09_48_16_426Z-debug-0.log

Do not report this issue to Homebrew/brew or Homebrew/core!

These open issues may also help:
Shopify CLI not installing on mac 12.4 via homebrew. https://github.com/Shopify/homebrew-shopify/issues/376
npm ERR! gyp verb build/config.gypi writing out config file: /opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar/build/config.gypi
npm ERR! gyp verb config.gypi checking for gypi file: /opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/opt/homebrew/Cellar/node/19.2.0/libexec/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   '/opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/opt/homebrew/Cellar/node/19.2.0/libexec/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/private/tmp/shopify-cli-20221212-93504-13akcx5/package/.brew_home/Library/Caches/node-gyp/19.2.0/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=/private/tmp/shopify-cli-20221212-93504-13akcx5/package/.brew_home/Library/Caches/node-gyp/19.2.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/Cellar/node/19.2.0/libexec/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/private/tmp/shopify-cli-20221212-93504-13akcx5/package/.brew_home/Library/Caches/node-gyp/19.2.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar',
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 verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture arm64
npm ERR! gyp verb node dev dir /private/tmp/shopify-cli-20221212-93504-13akcx5/package/.brew_home/Library/Caches/node-gyp/19.2.0
npm ERR! gyp verb `which` succeeded for `make` /opt/homebrew/Library/Homebrew/shims/mac/super/make
npm ERR! gyp verb bin symlinks adding symlinks (such as Python), at "/opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar/build/node_gyp_bins", to PATH
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/keytar_mac.cc:1:
npm ERR! In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:28:
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h:51:10: fatal error: 'Security/x509defs.h' file not found
npm ERR! #include <Security/x509defs.h>
npm ERR!          ^~~~~~~~~~~~~~~~~~~~~
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h:51:10: note: did not find header 'x509defs.h' in framework 'Security' (loaded from '/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks')
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/keytar/src/keytar_mac.o] Error 1
npm ERR! make: *** Waiting for unfinished jobs....
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.onExit (/opt/homebrew/Cellar/node/19.2.0/libexec/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/19.2.0/bin/node" "/opt/homebrew/Cellar/node/19.2.0/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /opt/homebrew/Cellar/shopify-cli/3.25.0/libexec/lib/node_modules/@shopify/cli/node_modules/keytar
npm ERR! gyp ERR! node -v v19.2.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok 
npm ERR! npm timing command:run Completed in 2155ms
npm ERR! npm verb exit 1
npm ERR! npm timing npm Completed in 2172ms
npm ERR! npm verb code 1
npm verb exit 1
npm timing npm Completed in 5371ms
npm verb unfinished npm timer reify 1670836729878
npm verb unfinished npm timer reify:build 1670836732004
npm verb unfinished npm timer build 1670836732004
npm verb unfinished npm timer build:deps 1670836732004
npm verb unfinished npm timer build:run:install 1670836732225
npm verb unfinished npm timer build:run:install:node_modules/@shopify/cli/node_modules/keytar 1670836732225
npm verb code 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brent/Library/Caches/Homebrew/npm_cache/_logs/2022-12-12T09_18_49_819Z-debug-0.log

HOMEBREW_VERSION: 3.6.14
ORIGIN: https://github.com/Homebrew/brew
HEAD: 001bacee18c512657e1535dff757c8cfdaefc116
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: f959f0f279451a11cc6e508721de6297c1a2dccf
Core tap last commit: 13 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_BOOTSNAP: set
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.38.2 => /opt/homebrew/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.5.1-arm64
CLT: 13.4.0.0.1.1651278267
Xcode: 14.1
Rosetta 2: false

HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /opt/homebrew/opt/icu4c:/opt/homebrew/opt/openssl@1.1:/opt/homebrew/opt/readline:/opt/homebrew/opt/ruby:/opt/homebrew
CMAKE_INCLUDE_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /opt/homebrew/opt/brotli/lib/pkgconfig:/opt/homebrew/opt/c-ares/lib/pkgconfig:/opt/homebrew/opt/icu4c/lib/pkgconfig:/opt/homebrew/opt/libnghttp2/lib/pkgconfig:/opt/homebrew/opt/libuv/lib/pkgconfig:/opt/homebrew/opt/openssl@1.1/lib/pkgconfig:/opt/homebrew/opt/libyaml/lib/pkgconfig:/opt/homebrew/opt/readline/lib/pkgconfig:/opt/homebrew/opt/ruby/lib/pkgconfig:/opt/homebrew/opt/pcre2/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/12
HOMEBREW_GIT: git
HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
ACLOCAL_PATH: /opt/homebrew/share/aclocal
PATH: /opt/homebrew/opt/node/libexec/bin:/opt/homebrew/Library/Homebrew/shims/mac/super:/opt/homebrew/opt/brotli/bin:/opt/homebrew/opt/c-ares/bin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/openssl@1.1/bin:/opt/homebrew/opt/node/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/gettext/bin:/opt/homebrew/opt/pcre2/bin:/opt/homebrew/opt/git/bin:/usr/bin:/bin:/usr/sbin:/sbin
jdockwarder commented 1 year ago

I had the same issue. It probably has to do with the node version that homebrew uses during installation. Here is what worked for me:

brew reinstall --build-from-source openssl@1.1

openssl@1.1 is a dependency of nodejs and sometimes acts up. Reinstalling it from source and then running the install command for shopify-cli afterwards worked like a charm for me.