Skip to content

Functions emulator does not work with yarn configured with pnpm nodeLinker #10813

Open

Description

@blikblum

[REQUIRED] Environment info

firebase-tools: 15.24.0

Platform: Ubuntu

[REQUIRED] Test case

The repository below contains a minimal firebase functions setup in a yarn with pnpm nodeLinker setup

Clone, execute yarn, cd functions, yarn serve

https://github.com/blikblum/firebase-functions-yarn

[REQUIRED] Steps to reproduce

  • Init a yarn package
  • Configure nodeLinker to pnpn
  • Run firebase init configuring functions (vanilla javascript) and functions emulator
  • Run yarn install
  • Run cd functions
  • Run yarn serve

[REQUIRED] Expected behavior

The functions emulator should start without errors

[REQUIRED] Actual behavior

yarn serve fails with error "Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK. Please file a bug on Github (https://github.com/firebase/firebase-tools/)."

[2026-07-18T13:00:20.859Z] ----------------------------------------------------------------------
[2026-07-18T13:00:20.860Z] Command: /home/luiz/.nvm/versions/node/v24.12.0/bin/node /home/luiz/.nvm/versions/node/v24.12.0/bin/firebase emulators:start --only functions --debug
[2026-07-18T13:00:20.861Z] CLI Version: 15.24.0
[2026-07-18T13:00:20.861Z] Platform: linux
[2026-07-18T13:00:20.861Z] Node Version: v24.12.0
[2026-07-18T13:00:20.861Z] Detected Agent: unknown
[2026-07-18T13:00:20.861Z] Time: Sat Jul 18 2026 10:00:20 GMT-0300 (Horário Padrão de Brasília)
[2026-07-18T13:00:20.861Z] ----------------------------------------------------------------------

[2026-07-18T13:00:21.279Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2026-07-18T13:00:21.279Z] > authorizing via signed-in user
i emulators: Starting emulators: functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions"}}
i emulators: Detected demo project ID "demo-no-project", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail. {"metadata":{"emulator":{"name":"hub"},"message":"Detected demo project ID "demo-no-project", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail."}}
[2026-07-18T13:00:21.282Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2026-07-18T13:00:21.282Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}]},"metadata":{"message":"assigned listening specs for emulators"}}
[2026-07-18T13:00:21.285Z] Write emulator hub locator at /tmp/hub-demo-no-project.json
[2026-07-18T13:00:21.288Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2026-07-18T13:00:21.288Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2026-07-18T13:00:21.288Z] [tasks] Cloud Tasks Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2026-07-18T13:00:21.289Z] late-assigned ports for functions and eventarc emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"functions":[{"address":"127.0.0.1","family":"IPv4","port":5001}],"eventarc":[{"address":"127.0.0.1","family":"IPv4","port":9299}],"tasks":[{"address":"127.0.0.1","family":"IPv4","port":9499}]},"metadata":{"message":"late-assigned ports for functions and eventarc emulators"}}
[2026-07-18T13:00:21.297Z] defaultcredentials: writing to file /home/luiz/.config/firebase/XXX_gmail.com_application_default_credentials.json
[2026-07-18T13:00:21.298Z] Setting GAC to /home/luiz/.config/firebase/XXX_gmail.com_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to /home/luiz/.config/firebase/XXX_gmail.com_application_default_credentials.json"}}
i functions: Watching "/home/luiz/repositories/firebase-functions-yarn/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching "/home/luiz/repositories/firebase-functions-yarn/functions" for Cloud Functions..."}}
[2026-07-18T13:00:21.307Z] Validating nodejs source
[2026-07-18T13:00:21.643Z] > [functions] package.json contents: {
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "24"
},
"main": "index.js",
"dependencies": {
"firebase-admin": "^13.6.0",
"firebase-functions": "^7.0.0"
},
"devDependencies": {
"firebase-functions-test": "^3.4.1"
},
"private": true
}
[2026-07-18T13:00:21.643Z] Building nodejs source
[2026-07-18T13:00:21.643Z] Failed to find version of module node: reached end of search path /home/luiz/repositories/firebase-functions-yarn/functions/node_modules
✔ functions: Using node@24 from host.
[2026-07-18T13:00:21.645Z] Could not find functions.yaml. Must use http discovery
⬢ functions: Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK. Please file a bug on Github (https://github.com/firebase/firebase-tools/). {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FirebaseError: Failed to find location of Firebase Functions SDK. Please file a bug on Github (https://github.com/firebase/firebase-tools/)."}}
[2026-07-18T13:00:21.653Z] Could not find VSCode notification endpoint: TypeError: fetch failed. If you are not running the Firebase SQL Connect VSCode extension, this is expected and not an issue.

┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000/ │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├───────────┼────────────────┼─────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
└───────────┴────────────────┴─────────────────────────────────┘
Emulator Hub host: 127.0.0.1 port: 4400
Other reserved ports: 4500

Activity

  1. blikblum commented on Jul 18, 2026

    @blikblum
    Author

    Yarn’s pnpm linker installs packages beneath node_modules/.store, while Firebase CLI searches conventional .bin locations and only handles native pnpm’s .pnpm layout. Yarn linker documentation, Firebase discovery implementation.

  2. aalej commented on Jul 21, 2026

    @aalej
    Contributor

    Thanks for the report @blikblum! I tried to clone the repository you shared, but it looks like the functions folder is missing from it. So I cloned it and ran firebase init to initialize a functions project. This reproduces the issue, but let me know in case I may have made a mistake with the setup - https://github.com/aalej/firebase-functions-yarn_10813

    I think your observations are correct. With Yarn's nodeLinker set to pnpm, the packages are located in <project_root>/node_modules/.store/** so the Firebase CLI fails to find the firebase-functions bin since it looks for it in .bin/function -

    const sourceNodeModulesPath = path.join(this.sourceDir, "node_modules");
    const projectNodeModulesPath = path.join(this.projectDir, "node_modules");
    const sdkPath = require.resolve("firebase-functions", { paths: [this.sourceDir] });
    const sdkNodeModulesPath = sdkPath.substring(0, sdkPath.lastIndexOf("node_modules") + 12);
    const ignorePnpmModulesPath = sdkNodeModulesPath.replace(/\/\.pnpm\/.*/, "");
    for (const nodeModulesPath of [
    sourceNodeModulesPath,
    projectNodeModulesPath,
    sdkNodeModulesPath,
    ignorePnpmModulesPath,
    ]) {
    const binPath = path.join(nodeModulesPath, ".bin", "firebase-functions");
    if (fileExistsSync(binPath)) {
    logger.debug(`Found firebase-functions binary at '${binPath}'`);
    return binPath;
    }
    }

    I'll raise this issue to our engineering team to see if we can support this behavior.

  3. blikblum commented on Jul 22, 2026

    @blikblum
    Author

    sorry. i forgot to push. Done now.

    Your setup shows the error accurately

  4. aalej commented on Jul 23, 2026

    @aalej
    Contributor

    quick update here: Discussed this with our engineering team, and we currently do not support using Yarn 2 with Firebase Functions. I'll mark this issue as a feature request. For those who are also interested in this, please leave a thumbs up on the original post to help us track the demand for this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions