Unable to install yarn deps because postinstall

Hey everyone, I was trying to run the frontend in development mode. When I tried yarn build and it failed. The log shows the following:
I kept seeing the error come from postinstall-postinstall. Thank you for helping out.

error /Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/postinstall-postinstall: Command failed.
Exit code: 1
Command: node ./run.js
Arguments:
Directory: /Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/postinstall-postinstall
Output:
SyntaxError: Unknown token: { line: 3, col: 2, type: 'INVALID', value: undefined } 3:2 in lockfile
    at Parser.unexpected (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:5064:11)
    at Parser.parse (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:5193:14)
    at parse (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:5262:17)
    at module.exports.exports.default (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:4835:96)
    at parseYarnLock (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/yarn-deduplicate/dist/index.js:7:42)
    at fixDuplicates (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/yarn-deduplicate/dist/index.js:123:18)
    at Object.<anonymous> (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/yarn-deduplicate/dist/cli.js:52:60)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object..js (node:internal/modules/cjs/loader:1708:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
error Command failed with exit code 1.
node:child_process:957
    throw err;
    ^

Error: Command failed: yarn run postinstall
SyntaxError: Unknown token: { line: 3, col: 2, type: 'INVALID', value: undefined } 3:2 in lockfile
    at Parser.unexpected (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:5064:11)
    at Parser.parse (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:5193:14)
    at parse (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:5262:17)
    at module.exports.exports.default (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/@yarnpkg/lockfile/index.js:4835:96)
    at parseYarnLock (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/yarn-deduplicate/dist/index.js:7:42)
    at fixDuplicates (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/yarn-deduplicate/dist/index.js:123:18)
    at Object.<anonymous> (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/yarn-deduplicate/dist/cli.js:52:60)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object..js (node:internal/modules/cjs/loader:1708:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
error Command failed with exit code 1.

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at Object.<anonymous> (/Users/loyyeeko/Code/OpenSource/contribute/metabase/node_modules/postinstall-postinstall/run.js:15:5)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object..js (node:internal/modules/cjs/loader:1708:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
    at Function._load (node:internal/modules/cjs/loader:1128:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14) {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(168) [Uint8Array] [
       36,  32, 105, 102,  32,  91,  32,  45, 122,  32,  34,  36,
       67,  73,  34,  32,  93,  59,  32, 116, 104, 101, 110,  32,
      121,  97, 114, 110,  45, 100, 101, 100, 117, 112, 108, 105,
       99,  97, 116, 101,  32,  45,  45, 115,  99, 111, 112, 101,
      115,  32,  64,  98,  97,  98, 101, 108,  32,  38,  38,  32,
      121,  97, 114, 110,  32, 112,  97, 116,  99, 104,  45, 112,
       97,  99, 107,  97, 103, 101,  59,  32, 102, 105,  10, 105,
      110, 102, 111,  32,  86, 105, 115, 105, 116,  32, 104, 116,
      116, 112, 115,  58,
      ... 68 more items
    ],
    Buffer(1209) [Uint8Array] [
       83, 121, 110, 116,  97, 120,  69, 114, 114, 111, 114,  58,
       32,  85, 110, 107, 110, 111, 119, 110,  32, 116, 111, 107,
      101, 110,  58,  32, 123,  32, 108, 105, 110, 101,  58,  32,
       51,  44,  32,  99, 111, 108,  58,  32,  50,  44,  32, 116,
      121, 112, 101,  58,  32,  39,  73,  78,  86,  65,  76,  73,
       68,  39,  44,  32, 118,  97, 108, 117, 101,  58,  32, 117,
      110, 100, 101, 102, 105, 110, 101, 100,  32, 125,  32,  51,
       58,  50,  32, 105, 110,  32, 108, 111,  99, 107, 102, 105,
      108, 101,  10,  32,
      ... 1109 more items
    ]
  ],
  pid: 25890,
  stdout: Buffer(168) [Uint8Array] [
     36,  32, 105, 102,  32,  91,  32,  45, 122,  32,  34,  36,
     67,  73,  34,  32,  93,  59,  32, 116, 104, 101, 110,  32,
    121,  97, 114, 110,  45, 100, 101, 100, 117, 112, 108, 105,
     99,  97, 116, 101,  32,  45,  45, 115,  99, 111, 112, 101,
    115,  32,  64,  98,  97,  98, 101, 108,  32,  38,  38,  32,
    121,  97, 114, 110,  32, 112,  97, 116,  99, 104,  45, 112,
     97,  99, 107,  97, 103, 101,  59,  32, 102, 105,  10, 105,
    110, 102, 111,  32,  86, 105, 115, 105, 116,  32, 104, 116,
    116, 112, 115,  58,
    ... 68 more items
  ],
  stderr: Buffer(1209) [Uint8Array] [
     83, 121, 110, 116,  97, 120,  69, 114, 114, 111, 114,  58,
     32,  85, 110, 107, 110, 111, 119, 110,  32, 116, 111, 107,
    101, 110,  58,  32, 123,  32, 108, 105, 110, 101,  58,  32,
     51,  44,  32,  99, 111, 108,  58,  32,  50,  44,  32, 116,
    121, 112, 101,  58,  32,  39,  73,  78,  86,  65,  76,  73,
     68,  39,  44,  32, 118,  97, 108, 117, 101,  58,  32, 117,
    110, 100, 101, 102, 105, 110, 101, 100,  32, 125,  32,  51,
     58,  50,  32, 105, 110,  32, 108, 111,  99, 107, 102, 105,
    108, 101,  10,  32,
    ... 1109 more items
  ]



node: v22.12.0

which yarn: /opt/homebrew/bin/yarn

yarn version: yarn set version 1.22.22

java: openjdk version "25" 2025-09-16 LTS
OpenJDK Runtime Environment Corretto-25.0.0.36.2 (build 25+36-LTS)
OpenJDK 64-Bit Server VM Corretto-25.0.0.36.2 (build 25+36-LTS, mixed mode, sharing)

javac: javac 25

Unknown token is simply that there’s a wrong character

I have done the following but still the same.

yarn cache clean
rm yarn.lock
rm -rf node_modules
yarn install

then I found this log, and the same as I first posted.

# This file contains the result of Yarn building a package (metabase@workspace:.)
# Script name: postinstall

Unbound variable "CI"
permission denied: then
permission denied: fi

Something is deeply broken with your build environment, it seems that it can’t execute shell scripts. What shell are you using?

I am using zsh.

A bit more information.

I am also using nvm, and my yarn was installed via homebrew.

Machine: MacBook Air

OS version: macOS: 26.1

Chip: Apple M1

you are right, there is some unusual with my macbook.

Everything works on my Debian.

I have tried switching from zsh to bash on my Mac, but it still failed :man_shrugging:

It might be worth trying to set up Docker and using the Docker build, which isolates the build tools & environment from your user environment.

1 Like

Thank you, I will give that a try. But I want to ask does it have to do with ARM vs X86?
My Debian is running on X86.

The crazy part is I have tried chsh to bash, and delete everything from .zshrc, and tried yard install, even running with arch -X86_64 yarn install, it still gave me the same error. I really want to contribute to the code base, and I am facing this weird error

Have you followed the instructions on this page? Especially the parts about installing the Xcode CLI tools and enabling Rosetta.

Also - You have JDK 25 installed but Metabase is only tested on JDK 21. Not likely the cause of your problems in this thread, you could run into Java compile failures due to JDK version differences.

Yes, I have been following the guide. I have xcode-select, Clojure, and different versions of Java on my machine with SDKMAN, that’s why I was shocked I wasn’t able to get it running locally and use REPL