npm package fails to install
Description
Failure log:
$ npm i @tdewolff/minify
npm ERR! code 1
npm ERR! path ~/Desktop/test-tdewolff/node_modules/@tdewolff/minify
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! ACTION Building Go library... minify.a
npm ERR! go build -buildmode=c-archive -o minify.a minify.go
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 | x64
npm ERR! gyp info find Python using Python version 3.9.13 found at "/usr/local/opt/[email protected]/bin/python3.9"
npm ERR! gyp info spawn /usr/local/opt/[email protected]/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '~/.nvm/versions/node/v16.14.2/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 '~/Desktop/test-tdewolff/node_modules/@tdewolff/minify/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '~/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '~/Library/Caches/node-gyp/16.14.2/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=~/Library/Caches/node-gyp/16.14.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=~/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=~/Library/Caches/node-gyp/16.14.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=~/Desktop/test-tdewolff/node_modules/@tdewolff/minify',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! bash: go: command not found
npm ERR! make[1]: *** [compile] Error 127
npm ERR! make: *** [minify.a] Error 2
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 (~/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.5.0
npm ERR! gyp ERR! command "~/.nvm/versions/node/v16.14.2/bin/node" "~/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd ~/Desktop/test-tdewolff/node_modules/@tdewolff/minify
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! ~/.npm/_logs/2022-07-10T21_11_54_788Z-debug-0.log
Other info
npx envinfo --system --binaries
System:
OS: macOS 12.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 280.41 MB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Thanks for the feedback. The obvious fix is to install Go and build from source, but the whole idea was that for at leats Windows/MacOS/Linux x64 we'd have prebuilds. I'm unsure why it doesn't use the prebuild binary...
Problem is in the directory structure from upload/download artifacts in the Github Action that makes node-gyp-build not find the binary. The next release should fix this, I'll keep you posted.
@privatenumber have you been able to try this with a new version (try v2.12.2)? Reading my own comment above that should've fixed it...
@privatenumber Any update on this? Regarding this fixed, please reopen if not.