添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

On Mac OS X (Intel) v12.3.1 to make compilation of native modules work, I had to add the following to my .npmrc :

python=/usr/local/bin/python3

It took me quite a bit of time to find this trick.

This is with:

  • node.js v16.14.0
  • npm v8.5.5
  • Why is this needed?
    Why can't node-gyp figure it out to try python3 instead?
    Should we document this?

    Perhaps v12.3.1, not v12.13.1? Apple finally made good on its commitment to not bundle Python in the OS.

    I believe that you can just type python3 on the command line and macOS will install it for you.

    Most Mac developers would brew install [email protected]

    Perhaps v12.3.1, not v12.13.1? Apple finally made good on its commitment to not bundle Python in the OS.

    I believe that you can just type python3 on the command line and macOS will install it for you.

    python3 is actually there, not sure where it came from.

    Most Mac developers would brew install [email protected]

    --verbose, e.g. npm install --verbose

    We'd be looking for, e.g. (from one of my Linux machines)

    gyp verb find Python Python is not set from command line or npm configuration
    gyp verb find Python Python is not set from environment variable PYTHON
    gyp verb find Python checking if "python3" can be used
    gyp verb find Python - executing "python3" to get executable path
    gyp verb find Python - executable path is "/usr/bin/python3"
    gyp verb find Python - executing "/usr/bin/python3" to get version
    gyp verb find Python - version is "3.6.8"
    gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
              

    Here it is:

    npm verb cli [
    npm verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node',
    npm verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/bin/npm',
    npm verb cli   'i',
    npm verb cli   '--verbose',
    npm verb cli   'sqlite3@4'
    npm verb cli ]
    npm info using [email protected]
    npm info using [email protected]
    npm timing npm:load:whichnode Completed in 0ms
    npm timing config:load:defaults Completed in 1ms
    npm timing config:load:file:/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/npmrc Completed in 1ms
    npm timing config:load:builtin Completed in 1ms
    npm timing config:load:cli Completed in 3ms
    npm timing config:load:env Completed in 0ms
    npm timing config:load:file:/Users/matteo/temp/gyp-bug/.npmrc Completed in 1ms
    npm timing config:load:project Completed in 6ms
    npm verb config init.author.name Use `--init-author-name` instead.
    npm verb config init.author.email Use `--init-author-email` instead.
    npm verb config init.license Use `--init-license` instead.
    npm timing config:load:file:/Users/matteo/.npmrc Completed in 2ms
    npm timing config:load:user Completed in 2ms
    npm timing config:load:file:/Users/matteo/.nvm/versions/node/v16.14.0/etc/npmrc Completed in 0ms
    npm timing config:load:global Completed in 0ms
    npm timing config:load:validate Completed in 1ms
    npm timing config:load:credentials Completed in 1ms
    npm timing config:load:setEnvs Completed in 0ms
    npm timing config:load Completed in 16ms
    npm timing npm:load:configload Completed in 16ms
    npm timing npm:load:setTitle Completed in 18ms
    npm timing config:load:flatten Completed in 2ms
    npm timing npm:load:display Completed in 6ms
    npm verb logfile /Users/matteo/.npm/_logs/2022-05-09T06_40_21_252Z-debug-0.log
    npm timing npm:load:logFile Completed in 4ms
    npm timing npm:load:timers Completed in 0ms
    npm timing npm:load:configScope Completed in 0ms
    npm timing npm:load Completed in 45ms
    npm timing arborist:ctor Completed in 1ms
    npm timing arborist:ctor Completed in 0ms
    npm timing idealTree:init Completed in 12ms
    npm timing idealTree:userRequests Completed in 3ms
    npm http fetch GET 200 https://registry.npmjs.org/sqlite3 13ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/nan 6ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/node-pre-gyp 6ms (cache hit)
    npm timing idealTree:#root Completed in 34ms
    npm http fetch GET 200 https://registry.npmjs.org/npmlog 21ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/nopt 24ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/rimraf 23ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/tar 23ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/detect-libc 29ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/npm-packlist 31ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/mkdirp 35ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/rc 34ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/needle 37ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/semver 38ms (cache hit)
    npm timing idealTree:node_modules/sqlite3 Completed in 49ms
    npm timing idealTree:node_modules/nan Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/console-control-strings 36ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/ignore-walk 39ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/npm-bundled 38ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/abbrev 40ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/npm-normalize-package-bin 39ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/debug 42ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/ini 38ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/osenv 43ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/are-we-there-yet 42ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/strip-json-comments 40ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/deep-extend 42ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/minimist 48ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/set-blocking 43ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/glob 42ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/gauge 49ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/safe-buffer 46ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/minizlib 46ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/minipass 47ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/fs-minipass 48ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/yallist 47ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/iconv-lite 56ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/sax 57ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/chownr 52ms (cache hit)
    npm timing idealTree:node_modules/node-pre-gyp Completed in 75ms
    npm timing idealTree:node_modules/detect-libc Completed in 0ms
    npm timing idealTree:node_modules/mkdirp Completed in 1ms
    npm timing idealTree:node_modules/minimist Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/ms 5ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/safer-buffer 5ms (cache hit)
    npm timing idealTree:node_modules/needle Completed in 8ms
    npm timing idealTree:node_modules/debug Completed in 1ms
    npm timing idealTree:node_modules/iconv-lite Completed in 1ms
    npm timing idealTree:node_modules/ms Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/os-homedir 5ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/os-tmpdir 7ms (cache hit)
    npm timing idealTree:node_modules/nopt Completed in 11ms
    npm timing idealTree:node_modules/abbrev Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/minimatch 7ms (cache hit)
    npm timing idealTree:node_modules/npm-packlist Completed in 11ms
    npm http fetch GET 200 https://registry.npmjs.org/brace-expansion 4ms (cache hit)
    npm timing idealTree:node_modules/ignore-walk Completed in 8ms
    npm http fetch GET 200 https://registry.npmjs.org/concat-map 5ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/balanced-match 8ms (cache hit)
    npm timing idealTree:node_modules/minimatch Completed in 10ms
    npm timing idealTree:node_modules/brace-expansion Completed in 3ms
    npm timing idealTree:node_modules/balanced-match Completed in 0ms
    npm timing idealTree:node_modules/concat-map Completed in 0ms
    npm timing idealTree:node_modules/npm-bundled Completed in 0ms
    npm timing idealTree:node_modules/npm-normalize-package-bin Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/aproba 23ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/object-assign 22ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/delegates 26ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/signal-exit 24ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/strip-ansi 24ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/readable-stream 31ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/wide-align 28ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/string-width 30ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/has-unicode 36ms (cache hit)
    npm timing idealTree:node_modules/npmlog Completed in 45ms
    npm http fetch GET 200 https://registry.npmjs.org/inherits 20ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/process-nextick-args 20ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/string_decoder 20ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/core-util-is 23ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/isarray 22ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/util-deprecate 21ms (cache hit)
    npm timing idealTree:node_modules/are-we-there-yet Completed in 28ms
    npm timing idealTree:node_modules/console-control-strings Completed in 0ms
    npm timing idealTree:node_modules/delegates Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/code-point-at 7ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/ansi-regex 7ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/is-fullwidth-code-point 8ms (cache hit)
    npm timing idealTree:node_modules/gauge Completed in 14ms
    npm timing idealTree:node_modules/aproba Completed in 0ms
    npm timing idealTree:node_modules/has-unicode Completed in 0ms
    npm timing idealTree:node_modules/object-assign Completed in 0ms
    npm timing idealTree:node_modules/osenv Completed in 2ms
    npm timing idealTree:node_modules/os-homedir Completed in 0ms
    npm timing idealTree:node_modules/os-tmpdir Completed in 0ms
    npm timing idealTree:node_modules/rc Completed in 2ms
    npm timing idealTree:node_modules/deep-extend Completed in 0ms
    npm timing idealTree:node_modules/ini Completed in 0ms
    npm timing idealTree:node_modules/readable-stream Completed in 6ms
    npm timing idealTree:node_modules/core-util-is Completed in 0ms
    npm timing idealTree:node_modules/inherits Completed in 0ms
    npm timing idealTree:node_modules/isarray Completed in 0ms
    npm timing idealTree:node_modules/process-nextick-args Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/inflight 8ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/once 9ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/fs.realpath 12ms (cache hit)
    npm http fetch GET 200 https://registry.npmjs.org/path-is-absolute 11ms (cache hit)
    npm timing idealTree:node_modules/rimraf Completed in 15ms
    npm http fetch GET 200 https://registry.npmjs.org/wrappy 4ms (cache hit)
    npm timing idealTree:node_modules/glob Completed in 9ms
    npm timing idealTree:node_modules/fs.realpath Completed in 0ms
    npm timing idealTree:node_modules/inflight Completed in 1ms
    npm timing idealTree:node_modules/once Completed in 0ms
    npm timing idealTree:node_modules/path-is-absolute Completed in 0ms
    npm timing idealTree:node_modules/safe-buffer Completed in 0ms
    npm timing idealTree:node_modules/safer-buffer Completed in 0ms
    npm timing idealTree:node_modules/sax Completed in 0ms
    npm timing idealTree:node_modules/semver Completed in 0ms
    npm timing idealTree:node_modules/set-blocking Completed in 0ms
    npm timing idealTree:node_modules/signal-exit Completed in 0ms
    npm timing idealTree:node_modules/string_decoder Completed in 0ms
    npm http fetch GET 200 https://registry.npmjs.org/number-is-nan 6ms (cache hit)
    npm timing idealTree:node_modules/string-width Completed in 10ms
    npm timing idealTree:node_modules/code-point-at Completed in 0ms
    npm timing idealTree:node_modules/is-fullwidth-code-point Completed in 1ms
    npm timing idealTree:node_modules/number-is-nan Completed in 0ms
    npm timing idealTree:node_modules/strip-ansi Completed in 1ms
    npm timing idealTree:node_modules/ansi-regex Completed in 0ms
    npm timing idealTree:node_modules/strip-json-comments Completed in 0ms
    npm timing idealTree:node_modules/tar Completed in 5ms
    npm timing idealTree:node_modules/chownr Completed in 0ms
    npm timing idealTree:node_modules/fs-minipass Completed in 0ms
    npm timing idealTree:node_modules/minipass Completed in 0ms
    npm timing idealTree:node_modules/minizlib Completed in 0ms
    npm timing idealTree:node_modules/util-deprecate Completed in 0ms
    npm timing idealTree:node_modules/wide-align Completed in 0ms
    npm timing idealTree:node_modules/wrappy Completed in 0ms
    npm timing idealTree:node_modules/yallist Completed in 0ms
    npm timing idealTree:node_modules/tar/node_modules/safe-buffer Completed in 0ms
    npm timing idealTree:buildDeps Completed in 359ms
    npm timing idealTree:fixDepFlags Completed in 2ms
    npm timing idealTree Completed in 379ms
    npm timing reify:loadTrees Completed in 379ms
    npm timing reify:diffTrees Completed in 2ms
    npm timing reify:retireShallow Completed in 0ms
    npm timing reify:createSparse Completed in 15ms
    npm timing reify:loadBundles Completed in 0ms
    npm timing reifyNode:node_modules/ansi-regex Completed in 181ms
    npm timing reifyNode:node_modules/number-is-nan Completed in 180ms
    npm timing reifyNode:node_modules/fs-minipass Completed in 181ms
    npm timing reifyNode:node_modules/code-point-at Completed in 181ms
    npm timing reifyNode:node_modules/wrappy Completed in 181ms
    npm timing reifyNode:node_modules/chownr Completed in 182ms
    npm timing reifyNode:node_modules/is-fullwidth-code-point Completed in 182ms
    npm timing reifyNode:node_modules/path-is-absolute Completed in 182ms
    npm timing reifyNode:node_modules/inflight Completed in 182ms
    npm timing reifyNode:node_modules/once Completed in 183ms
    npm timing reifyNode:node_modules/process-nextick-args Completed in 183ms
    npm timing reifyNode:node_modules/strip-json-comments Completed in 182ms
    npm timing reifyNode:node_modules/os-tmpdir Completed in 183ms
    npm timing reifyNode:node_modules/ini Completed in 183ms
    npm timing reifyNode:node_modules/os-homedir Completed in 183ms
    npm timing reifyNode:node_modules/string-width Completed in 184ms
    npm timing reifyNode:node_modules/wide-align Completed in 184ms
    npm timing reifyNode:node_modules/has-unicode Completed in 184ms
    npm timing reifyNode:node_modules/object-assign Completed in 184ms
    npm timing reifyNode:node_modules/aproba Completed in 184ms
    npm timing reifyNode:node_modules/strip-ansi Completed in 185ms
    npm timing reifyNode:node_modules/npm-bundled Completed in 185ms
    npm timing reifyNode:node_modules/brace-expansion Completed in 186ms
    npm timing reifyNode:node_modules/ignore-walk Completed in 186ms
    npm timing reifyNode:node_modules/abbrev Completed in 186ms
    npm timing reifyNode:node_modules/osenv Completed in 186ms
    npm timing reifyNode:node_modules/ms Completed in 187ms
    npm timing reifyNode:node_modules/npm-packlist Completed in 189ms
    npm timing reifyNode:node_modules/minizlib Completed in 194ms
    npm timing reifyNode:node_modules/minipass Completed in 194ms
    npm timing reifyNode:node_modules/inherits Completed in 194ms
    npm timing reifyNode:node_modules/core-util-is Completed in 194ms
    npm timing reifyNode:node_modules/signal-exit Completed in 194ms
    npm timing reifyNode:node_modules/set-blocking Completed in 194ms
    npm timing reifyNode:node_modules/console-control-strings Completed in 194ms
    npm timing reifyNode:node_modules/yallist Completed in 198ms
    npm timing reifyNode:node_modules/util-deprecate Completed in 198ms
    npm timing reifyNode:node_modules/fs.realpath Completed in 198ms
    npm timing reifyNode:node_modules/balanced-match Completed in 198ms
    npm timing reifyNode:node_modules/rimraf Completed in 198ms
    npm timing reifyNode:node_modules/safe-buffer Completed in 201ms
    npm timing reifyNode:node_modules/string_decoder Completed in 201ms
    npm timing reifyNode:node_modules/deep-extend Completed in 200ms
    npm timing reifyNode:node_modules/minimatch Completed in 200ms
    npm timing reifyNode:node_modules/mkdirp Completed in 200ms
    npm timing reifyNode:node_modules/npmlog Completed in 201ms
    npm timing reifyNode:node_modules/isarray Completed in 204ms
    npm timing reifyNode:node_modules/sax Completed in 203ms
    npm timing reifyNode:node_modules/tar/node_modules/safe-buffer Completed in 204ms
    npm timing reifyNode:node_modules/delegates Completed in 205ms
    npm timing reifyNode:node_modules/concat-map Completed in 206ms
    npm timing reifyNode:node_modules/are-we-there-yet Completed in 208ms
    npm timing reifyNode:node_modules/safer-buffer Completed in 207ms
    npm timing reifyNode:node_modules/nopt Completed in 208ms
    npm timing reifyNode:node_modules/detect-libc Completed in 207ms
    npm timing reifyNode:node_modules/glob Completed in 211ms
    npm timing reifyNode:node_modules/semver Completed in 210ms
    npm timing reifyNode:node_modules/debug Completed in 212ms
    npm timing reifyNode:node_modules/rc Completed in 216ms
    npm timing reifyNode:node_modules/npm-normalize-package-bin Completed in 221ms
    npm timing reifyNode:node_modules/gauge Completed in 227ms
    npm timing reifyNode:node_modules/minimist Completed in 228ms
    npm timing reifyNode:node_modules/readable-stream Completed in 235ms
    npm timing reifyNode:node_modules/tar Completed in 237ms
    npm timing reifyNode:node_modules/iconv-lite Completed in 240ms
    npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
    npm timing reifyNode:node_modules/node-pre-gyp Completed in 240ms
    npm timing reifyNode:node_modules/needle Completed in 246ms
    npm timing reifyNode:node_modules/nan Completed in 249ms
    npm timing reifyNode:node_modules/sqlite3 Completed in 269ms
    npm timing reify:unpack Completed in 274ms
    npm timing reify:unretire Completed in 0ms
    npm timing build:queue Completed in 4ms
    npm timing build:link:node_modules/detect-libc Completed in 5ms
    npm timing build:link:node_modules/node-pre-gyp Completed in 4ms
    npm timing build:link:node_modules/nopt Completed in 4ms
    npm timing build:link:node_modules/semver Completed in 4ms
    npm timing build:link:node_modules/rc Completed in 4ms
    npm timing build:link:node_modules/mkdirp Completed in 5ms
    npm timing build:link:node_modules/rimraf Completed in 5ms
    npm timing build:link:node_modules/needle Completed in 5ms
    npm timing build:link Completed in 6ms
    npm info run [email protected] install node_modules/sqlite3 node-pre-gyp install --fallback-to-build
    npm info run [email protected] install { code: 1, signal: null }
    npm timing reify:rollback:createSparse Completed in 94ms
    npm timing reify:rollback:retireShallow Completed in 0ms
    npm timing command:i Completed in 3291ms
    npm verb stack Error: command failed
    npm verb stack     at ChildProcess.<anonymous> (/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
    npm verb stack     at ChildProcess.emit (node:events:520:28)
    npm verb stack     at maybeClose (node:internal/child_process:1092:16)
    npm verb stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
    npm verb pkgid [email protected]
    npm verb cwd /Users/matteo/temp/gyp-bug
    npm verb Darwin 21.4.0
    npm verb argv "/Users/matteo/.nvm/versions/node/v16.14.0/bin/node" "/Users/matteo/.nvm/versions/node/v16.14.0/bin/npm" "i" "--verbose" "sqlite3@4"
    npm verb node v16.14.0
    npm verb npm  v8.5.5
    npm ERR! code 1
    npm ERR! path /Users/matteo/temp/gyp-bug/node_modules/sqlite3
    npm ERR! command failed
    npm ERR! command sh -c node-pre-gyp install --fallback-to-build
    npm ERR! LD_LIBRARY_PATH=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/build/Release/lib.host:/Users/matteo/temp/gyp-bug/node_modules/sqlite3/build/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps; mkdir -p /Users/matteo/temp/gyp-bug/node_modules/sqlite3/build/Release/obj/gen/sqlite-autoconf-3310100; python ./extract.py ./sqlite-autoconf-3310100.tar.gz "/Users/matteo/temp/gyp-bug/node_modules/sqlite3/build/Release/obj/gen"
    npm ERR! Failed to execute '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node /Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
    npm ERR! node-pre-gyp info it worked if it ends with ok
    npm ERR! node-pre-gyp verb cli [
    npm ERR! node-pre-gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node',
    npm ERR! node-pre-gyp verb cli   '/Users/matteo/temp/gyp-bug/node_modules/.bin/node-pre-gyp',
    npm ERR! node-pre-gyp verb cli   'install',
    npm ERR! node-pre-gyp verb cli   '--fallback-to-build'
    npm ERR! node-pre-gyp verb cli ]
    npm ERR! node-pre-gyp info using [email protected]
    npm ERR! node-pre-gyp info using [email protected] | darwin | x64
    npm ERR! node-pre-gyp verb command install []
    npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download 
    npm ERR! node-pre-gyp info check checked for "/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node" (not found)
    npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-darwin-x64.tar.gz
    npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-darwin-x64.tar.gz
    npm ERR! node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v93-darwin-x64.tar.gz 
    npm ERR! node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v93 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-v93-darwin-x64.tar.gz 
    npm ERR! node-pre-gyp verb command build [ 'rebuild' ]
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp verb cli [
    npm ERR! gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node',
    npm ERR! gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
    npm ERR! gyp verb cli   'clean'
    npm ERR! gyp verb cli ]
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | darwin | x64
    npm ERR! gyp verb command clean []
    npm ERR! gyp verb clean removing "build" directory
    npm ERR! gyp info ok 
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp verb cli [
    npm ERR! gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node',
    npm ERR! gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
    npm ERR! gyp verb cli   'configure',
    npm ERR! gyp verb cli   '--fallback-to-build',
    npm ERR! gyp verb cli   '--module=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node',
    npm ERR! gyp verb cli   '--module_name=node_sqlite3',
    npm ERR! gyp verb cli   '--module_path=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64',
    npm ERR! gyp verb cli   '--napi_version=8',
    npm ERR! gyp verb cli   '--node_abi_napi=napi',
    npm ERR! gyp verb cli   '--napi_build_version=0',
    npm ERR! gyp verb cli   '--node_napi_label=node-v93'
    npm ERR! gyp verb cli ]
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | darwin | x64
    npm ERR! gyp verb command configure []
    npm ERR! gyp verb find Python Python is not set from command line or npm configuration
    npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
    npm ERR! gyp verb find Python checking if "python3" can be used
    npm ERR! gyp verb find Python - executing "python3" to get executable path
    npm ERR! gyp verb find Python - executable path is "/usr/local/opt/[email protected]/bin/python3.9"
    npm ERR! gyp verb find Python - executing "/usr/local/opt/[email protected]/bin/python3.9" to get version
    npm ERR! gyp verb find Python - version is "3.9.10"
    npm ERR! gyp info find Python using Python version 3.9.10 found at "/usr/local/opt/[email protected]/bin/python3.9"
    npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.14.0
    npm ERR! gyp verb command install [ '16.14.0' ]
    npm ERR! gyp verb install input version string "16.14.0"
    npm ERR! gyp verb install installing version: 16.14.0
    npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
    npm ERR! gyp verb install version is already installed, need to check "installVersion"
    npm ERR! gyp verb got "installVersion" 9
    npm ERR! gyp verb needs "installVersion" 9
    npm ERR! gyp verb install version is good
    npm ERR! gyp verb get node dir target node version installed: 16.14.0
    npm ERR! gyp verb build dir attempting to create "build" dir: /Users/matteo/temp/gyp-bug/node_modules/sqlite3/build
    npm ERR! gyp verb build dir "build" dir needed to be created? Yes
    npm ERR! gyp verb build/config.gypi creating config file
    npm ERR! gyp verb build/config.gypi writing out config file: /Users/matteo/temp/gyp-bug/node_modules/sqlite3/build/config.gypi
    npm ERR! gyp verb config.gypi checking for gypi file: /Users/matteo/temp/gyp-bug/node_modules/sqlite3/config.gypi
    npm ERR! gyp verb common.gypi checking for gypi file: /Users/matteo/temp/gyp-bug/node_modules/sqlite3/common.gypi
    npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
    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   '/Users/matteo/.nvm/versions/node/v16.14.0/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/matteo/temp/gyp-bug/node_modules/sqlite3/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/matteo/Library/Caches/node-gyp/16.14.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=/Users/matteo/Library/Caches/node-gyp/16.14.0',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/matteo/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/matteo/temp/gyp-bug/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 verb cli [
    npm ERR! gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node',
    npm ERR! gyp verb cli   '/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
    npm ERR! gyp verb cli   'build',
    npm ERR! gyp verb cli   '--fallback-to-build',
    npm ERR! gyp verb cli   '--module=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node',
    npm ERR! gyp verb cli   '--module_name=node_sqlite3',
    npm ERR! gyp verb cli   '--module_path=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64',
    npm ERR! gyp verb cli   '--napi_version=8',
    npm ERR! gyp verb cli   '--node_abi_napi=napi',
    npm ERR! gyp verb cli   '--napi_build_version=0',
    npm ERR! gyp verb cli   '--node_napi_label=node-v93'
    npm ERR! gyp verb cli ]
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | darwin | x64
    npm ERR! gyp verb command build []
    npm ERR! gyp verb build type Release
    npm ERR! gyp verb architecture x64
    npm ERR! gyp verb node dev dir /Users/matteo/Library/Caches/node-gyp/16.14.0
    npm ERR! gyp verb `which` succeeded for `make` /usr/bin/make
    npm ERR! gyp info spawn make
    npm ERR! gyp info spawn args [ 'V=1', '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.onExit (/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
    npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    npm ERR! gyp ERR! System Darwin 21.4.0
    npm ERR! gyp ERR! command "/Users/matteo/.nvm/versions/node/v16.14.0/bin/node" "/Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
    npm ERR! gyp ERR! cwd /Users/matteo/temp/gyp-bug/node_modules/sqlite3
    npm ERR! gyp ERR! node -v v16.14.0
    npm ERR! gyp ERR! node-gyp -v v9.0.0
    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 '/Users/matteo/.nvm/versions/node/v16.14.0/bin/node /Users/matteo/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/matteo/temp/gyp-bug/node_modules/sqlite3/lib/binding/node-v93-darwin-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/matteo/temp/gyp-bug/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
    npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
    npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
    npm ERR! node-pre-gyp ERR! System Darwin 21.4.0
    npm ERR! node-pre-gyp ERR! command "/Users/matteo/.nvm/versions/node/v16.14.0/bin/node" "/Users/matteo/temp/gyp-bug/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
    npm ERR! node-pre-gyp ERR! cwd /Users/matteo/temp/gyp-bug/node_modules/sqlite3
    npm ERR! node-pre-gyp ERR! node -v v16.14.0
    npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
    npm ERR! node-pre-gyp ERR! not ok
    npm verb exit 1
    npm timing npm Completed in 3566ms
    npm verb unfinished npm timer reify 1652078421518
    npm verb unfinished npm timer reify:build 1652078422197
    npm verb unfinished npm timer build 1652078422198
    npm verb unfinished npm timer build:deps 1652078422198
    npm verb unfinished npm timer build:run:install 1652078422208
    npm verb unfinished npm timer build:run:install:node_modules/sqlite3 1652078422208
    npm verb code 1
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/matteo/.npm/_logs/2022-05-09T06_40_21_252Z-debug-0.log
              

    I believe that a bare bone macOS has a python3 executable which is not the interpreter but is instead a stub which when run, asks the user if they want Python 3 installed. If the user says Yes then the installation of Python 3 happens which replaces that executable. The next time the user runs python3, they get the real deal. There was something similar in macOS for java. Does someone have a fresh macOS install that can prove that to be true?

    The built-in python3 executable is a valid pre-installed binary on the latest Mac OS X Monterrey:

    $ which python
    python not found
    $ which python3
    /usr/bin/python3
    $ /usr/bin/python3 --version
    Python 3.8.9

    The problem is that the python binary is hard-coded somewhere in node-gyp instead of python3. python binary was removed from Mac OS 12.3. Installing any version of python3 from homebrew does not automatically link it (brew install python actually installs python 3.9). After doing brew link python the python symlink pointed to the installed python3 binary is created and node-gyp does not fail anymore.

    node-gyp should properly detect that there is no python but only python3 in the PATH, and use that binary instead of failing.

    For those using yarn in a (older) Rails app and a Python installation via pyenv, this finally solved it for me after hours of applying every possible suggested solution:

    pyenv install 2.7.18
    yarn config set python "/Users/$USER/.pyenv/shims/python2.7""
    

    This will add that config to ~/.yarnrc

    Also I made sure to undo as much of the previous given solutions in the other files like: ~/.zsh_profile ~/.zshrc ~/.npmrc

    And finally I had to remove the yarn.lock file and update a webpacker version as is suggested here.

    Then when running yarn it correctly installed everything.

    Python 2 died 876 days ago on 1/1/2020 so it is no longer supported and @oscaredel must be relying on a very out-of-date release of node-gyp.

    The solution of @Fiorello is aligned with our README.md.

    Python 2 died 876 days ago on 1/1/2020 so it is no longer supported and @oscaredel must be relying on a very out-of-date release of node-gyp.

    The solution of @Fiorello is aligned with our README.md.

    That's correct. The problem is that by default we cannot install binary modules and the result is a very cryptic error for those not familiar with the project. The user experience is really degraded and a tiny fix in this library could improve it quite a lot.

    Specifically:

    Instead of using xcode-install to get the cli tools, we should check if python3 is available.

    Xcode command line tools does NOT install Python. Node-gyp is using CLT for things like C/C++ compilers.

    EDIT: The NOT is removed based on the evidence in replies below.

    Python 2 died 876 days ago on 1/1/2020 so it is no longer supported and @oscaredel must be relying on a very out-of-date release of node-gyp.

    Yes, can confirm I sometimes have to maintain some low-maintained older applications. I'm not very familiar with this stuff. Honestly, I don't even remember now what I was working on then. I just did a write-up for what worked should anybody else run into a similar error and land on this page. So feel free to ignore any of my comments if they seem dumb.

    I have a hard time finding a solution to this problem.
    Have tried with npm config set python python3, and yarn config set python "/opt/homebrew/bin/python3", no success.

    It still seems to try to use python.

    @cclauss I saw a link to this PR #2362 but that does not seem to help me.

  • Macbook Pro 16" m1
  • [email protected]
  • [email protected]
  • [email protected]
  • npm ERR! code 1
    npm ERR! path /Users/me/code/node_modules/gl
    npm ERR! command failed
    npm ERR! command sh -c -- prebuild-install || node-gyp rebuild
    npm ERR! prebuild-install info begin Prebuild-install version 7.1.1
    npm ERR! prebuild-install info looking for local prebuild @ prebuilds/gl-v5.0.3-node-v111-darwin-arm64.tar.gz
    npm ERR! prebuild-install info looking for cached prebuild @ /Users/niftitech/.npm/_prebuilds/e4bfec-gl-v5.0.3-node-v111-darwin-arm64.tar.gz
    npm ERR! prebuild-install http request GET https://github.com/stackgl/headless-gl/releases/download/v5.0.3/gl-v5.0.3-node-v111-darwin-arm64.tar.gz
    npm ERR! prebuild-install http 404 https://github.com/stackgl/headless-gl/releases/download/v5.0.3/gl-v5.0.3-node-v111-darwin-arm64.tar.gz
    npm ERR! prebuild-install warn install No prebuilt binaries found (target=19.1.0 runtime=node arch=arm64 libc= platform=darwin)
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp verb cli [
    npm ERR! gyp verb cli   '/usr/local/bin/node',
    npm ERR! gyp verb cli   '/Users/me/code/node_modules/.bin/node-gyp',
    npm ERR! gyp verb cli   'rebuild'
    npm ERR! gyp verb cli ]
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | darwin | arm64
    npm ERR! gyp verb command rebuild []
    npm ERR! gyp verb command clean []
    npm ERR! gyp verb clean removing "build" directory
    npm ERR! gyp verb command configure []
    npm ERR! gyp verb find Python checking Python explicitly set from command line or npm configuration
    npm ERR! gyp verb find Python - "--python=" or "npm config get python" is "python3"
    npm ERR! gyp verb find Python - executing "python3" to get executable path
    npm ERR! gyp verb find Python - executable path is "/opt/homebrew/opt/[email protected]/bin/python3.10"
    npm ERR! gyp verb find Python - executing "/opt/homebrew/opt/[email protected]/bin/python3.10" to get version
    npm ERR! gyp verb find Python - version is "3.10.8"
    npm ERR! gyp info find Python using Python version 3.10.8 found at "/opt/homebrew/opt/[email protected]/bin/python3.10"
    npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 19.1.0
    npm ERR! gyp verb command install [ '19.1.0' ]
    npm ERR! gyp verb install input version string "19.1.0"
    npm ERR! gyp verb install installing version: 19.1.0
    npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
    npm ERR! gyp verb install version is already installed, need to check "installVersion"
    npm ERR! gyp verb got "installVersion" 9
    npm ERR! gyp verb needs "installVersion" 9
    npm ERR! gyp verb install version is good
    npm ERR! gyp verb get node dir target node version installed: 19.1.0
    npm ERR! gyp verb build dir attempting to create "build" dir: /Users/me/code/node_modules/gl/build
    npm ERR! gyp verb build dir "build" dir needed to be created? Yes
    npm ERR! gyp verb python symlink creating symlink to "/opt/homebrew/opt/[email protected]/bin/python3.10" at "/Users/me/code/node_modules/gl/build/node_gyp_bins/python3"
    npm ERR! gyp verb build/config.gypi creating config file
    npm ERR! gyp verb build/config.gypi writing out config file: /Users/me/code/node_modules/gl/build/config.gypi
    npm ERR! gyp verb config.gypi checking for gypi file: /Users/me/code/node_modules/gl/config.gypi
    npm ERR! gyp verb common.gypi checking for gypi file: /Users/me/code/node_modules/gl/common.gypi
    npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
    npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.10
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   '/Users/me/code/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/me/code/node_modules/gl/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/me/code/node_modules/node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/niftitech/Library/Caches/node-gyp/19.1.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=/Users/niftitech/Library/Caches/node-gyp/19.1.0',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/me/code/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/niftitech/Library/Caches/node-gyp/19.1.0/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/me/code/node_modules/gl',
    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! /bin/sh: python: command not found
    npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
    npm ERR! gyp ERR! configure error 
    npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/me/code/node_modules/node-gyp/lib/configure.js:325:16)
    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 "/usr/local/bin/node" "/Users/me/code/node_modules/.bin/node-gyp" "rebuild"
    npm ERR! gyp ERR! cwd /Users/me/code/node_modules/gl
    npm ERR! gyp ERR! node -v v19.1.0
    npm ERR! gyp ERR! node-gyp -v v9.3.0
    npm ERR! gyp ERR! not ok
              

    node-gyp found Python 3.10 and is happy to use it but... You need to edit angle/src/angle.gyp and change
    python commit_id.py check -->
    python3 commit_id.py check

    @cclauss I installed pyenv and added Python 2.7.
    Then I also had to downgrade to Node 18, otherwise the package I wanted to install dit not install.
    Don't know why that helped, but I'm happy it did.

    Run into today while setting up my new M1 Macbook.

    installed nodenv and that's what I get when attempting to install v12 node. Node v18 is already in place and it's been installed with no such issues.

    ➜  ~ nodenv install 12.22.12
    Downloading node-v12.22.12.tar.gz...
    -> https://nodejs.org/dist/v12.22.12/node-v12.22.12.tar.gz
    WARNING: node-v12.22.12 is in LTS Maintenance mode and nearing its end of life.
    It only receives *critical* security updates, *critical* bug fixes and documentation updates.
    Installing node-v12.22.12...
    BUILD FAILED (OS X 13.0.1 using node-build 4.9.100)
    Inspect or clean up the working tree at /var/folders/w8/y_tch3yd1r7_6nhrz4m4k6vh0000gn/T/node-build.20221201002133.39299.6lW2Kx
    Results logged to /var/folders/w8/y_tch3yd1r7_6nhrz4m4k6vh0000gn/T/node-build.20221201002133.39299.log
    Last 10 log lines:
    make: python: Command not found
    make: python: Command not found
    make: python: Command not found
    make: python: Command not found
    make: python: Command not found
    make: python: Command not found
    make: python: Command not found
    make: python: Command not found
    Missing or stale config.gypi, please run ./configure
    

    I tried being smart and aliased python to python3 but that didn't change anything

    ➜  ~ which python
    python: aliased to python3
    ➜  ~ python
    Python 3.9.6 (default, Sep 26 2022, 11:37:49)
    [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    

    Note for you @cclauss - python3 came preinstalled with my system 13.0.1 (22A400) - I didn't have to do anything.

    For my case, it was better to make just symbolic link for python3 to python. it worked for me.
    (24-inch, M1, 2021)

    Python3 was Installed using brew before.

    $ cd /opt/homebrew/bin
    $ sudo ln -sf python3 python
      aica231, erohin, bthj, nsollecito, erbunao, alfredsgenkins, xenokratos, GregBaLpro, AI-Chef, romaleev, and 6 more reacted with thumbs up emoji
      Szymen, tracid, fgcui1204, bhritch, aica231, peiris, pChausseC, matttturnbull, Klockner, and gabrielrtakeda reacted with heart emoji
        All reactions
    

    For my case, it was better to make just symbolic link for python3 to python. it worked for me. (24-inch, M1, 2021)

    Python3 was Installed using brew before.

    $ cd /opt/homebrew/bin
    $ sudo ln -sf python3 python
              

    The strong recommendation here is to create a venv which will give you a local python that you can pip install your project-related dependencies into without effecting other Python projects on your system.
    https://snarky.ca/how-virtual-environments-work

    For my case, it was better to make just symbolic link for python3 to python. it worked for me. (24-inch, M1, 2021)

    Python3 was Installed using brew before.

    $ cd /opt/homebrew/bin
    $ sudo ln -sf python3 python
    

    This seems like it'll work, but for me it's failing because it looks for a very specific version of python:

    Please use python3.10 or python3.9 or python3.8 or python3.7 or python3.6 or python3.5 or python2.7.
    Node.js configure: Found Python 3.11.3...
    

    Kind of silly, but I'll downgrade Python for now to get around it

    For my case, it was better to make just symbolic link for python3 to python. it worked for me. (24-inch, M1, 2021)

    Python3 was Installed using brew before.

    $ cd /opt/homebrew/bin
    $ sudo ln -sf python3 python
    

    this solution even working on ubuntu lts 20