alex-pinkus/tree-sitter-swift

npm install fails on macOS 14.4 (M1 Pro)

iamstuba opened this issue · 2 comments

Environment

OS: macOS 14.4
Node: 18.18.2
npm: 9.8.1
arch: arm64

Notes

  • Also happens on latest Node LTS (Node 20.11.1, npm 10.2.4)

Setup

package.json

{
  "dependencies": {
    "tree-sitter": "^0.21.0",
    "tree-sitter-swift": "^0.4.3"
  }
}

Observed behavior

npm install

verbose stack Error: command failed
verbose stack     at ChildProcess.<anonymous> (/Users/stuba/Library/Application Support/fnm/node-versions/v18.18.2/installation/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
verbose stack     at ChildProcess.emit (node:events:517:28)
verbose stack     at maybeClose (node:internal/child_process:1098:16)
verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
verbose pkgid tree-sitter-swift@0.4.3
verbose cwd /Users/stuba/Projects/test
verbose Darwin 23.4.0
verbose node v18.18.2
verbose npm  v9.8.1
error code 1
error path /Users/stuba/Projects/test/node_modules/tree-sitter-swift
error command failed
error command sh -c node scripts/wait-for-tree-sitter.js && tree-sitter generate
error node:internal/child_process:414
error     throw errnoException(err, 'spawn');
error     ^
error
error Error: spawn Unknown system error -86
error     at ChildProcess.spawn (node:internal/child_process:414:11)
error     at spawn (node:child_process:761:9)
error     at Object.<anonymous> (/Users/stuba/Projects/test/node_modules/tree-sitter-cli/cli.js:8:1)
error     at Module._compile (node:internal/modules/cjs/loader:1256:14)
error     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
error     at Module.load (node:internal/modules/cjs/loader:1119:32)
error     at Module._load (node:internal/modules/cjs/loader:960:12)
error     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
error     at node:internal/main/run_main_module:23:47 {
error   errno: -86,
error   code: 'Unknown system error -86',
error   syscall: 'spawn'
error }
error
error Node.js v18.18.2
verbose exit 1

Expected behavior

No errors.

Current workaround

softwareupdate --install-rosetta (Taken from: pa11y/pa11y#619 (comment))

Interesting -- looking at tree-sitter/tree-sitter#2178, I'm guessing this should be fixed by updating this line to 0.20.8?

Looks like it, great find! I can test on my second M1 MacBook later. 👍 (Uninstalling Rosetta seems like a hassle, so I'd rather not do that.)