Do not install forge cli with pnpm

Just sharing this in case it helps someone avoid hours of frustration.

If you’ve installed the Forge CLI using pnpm and you see this when trying to log in:

$ forge login
Log in to your Atlassian account
Press Ctrl+C to cancel.

? Enter your email: sh....

Next, enter your Atlassian API token. If you don't have a token, visit this URL to create one:

? Enter your Atlassian API token: [hidden]

✕ Logging you in...

Error: The CLI couldn't securely store your login credentials in a local keychain. Ensure you enable access to the macOS keychain when prompted. If a local keychain is not available, use environment variables before trying again.

:collision: The problem is pnpm breaks native module resolution for keytar, which Forge uses to store credentials in the macOS keychain.


:white_check_mark: Fix

Uninstall the Forge CLI from pnpm:

pnpm remove -g @forge/cli

Then reinstall it with npm instead:

npm install -g @forge/cli

That fixes the keychain integration, and forge login works as expected.


:pushpin: Related

I reported the root cause in the pnpm repo:
:link: keytar not found · Issue #9623 · pnpm/pnpm · GitHub

Hope this saves someone a few hours of debugging :slightly_smiling_face:

4 Likes

We have several Forge projects using pnpm successfully.

You can just add to your package.json the following :

"pnpm": {
    "ignoredBuiltDependencies": [],
    "onlyBuiltDependencies": [
      "@forge/cli",
      "cloudflared",
      "core-js",
      "esbuild",
      "keytar"
    ]
  }
3 Likes

Alright even better… Thx

From our experience, pnpm is such a relief compare to classic npm.

  • faster
  • more reliable
  • handles conflicts better