Skip to content

Initializing Genkit ends in a peer dependency issue (ERESOLVE unable to resolve dependency tree) #7849

@OscarArranz

Description

@OscarArranz

[REQUIRED] Environment info

firebase-tools: 13.22.1

Platform: Fedora

[REQUIRED] Test case

When running firebase init genkit at the step of installing the Genkit dependencies, a dependency error happens.

[REQUIRED] Steps to reproduce

To reproduce the issue you just need to run firebase init genkit on either an existing firebase project or while creating a completely new project, either way you'll get an error along the way if you let the command install dependencies for you with npm.

[REQUIRED] Expected behavior

The command should initialize Firebase Functions along with Genkit.

[REQUIRED] Actual behavior

✖ Failed to install NPM packages: Error: Command failed: npm install zod express @genkit-ai/core @genkit-ai/ai @genkit-ai/dotprompt @genkit-ai/flow @genkit-ai/firebase @genkit-ai/googleai --save
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: functions@undefined
npm error Found: firebase-functions@6.0.1
npm error node_modules/firebase-functions
npm error   firebase-functions@"^6.0.1" from the root project
npm error
npm error Could not resolve dependency:
npm error peer firebase-functions@"^4.8.0 || ^5.0.0" from @genkit-ai/firebase@0.5.16
npm error node_modules/@genkit-ai/firebase
npm error   @genkit-ai/firebase@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/oscar/.npm/_logs/2024-10-18T08_34_11_231Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/oscar/.npm/_logs/2024-10-18T08_34_11_231Z-debug-0.log

Genkit initialization failed...

I believe this bug was introducing when bumping the firebase-admin and firebase-functions dependencies in #7809.

Downgrading firebase-tools to 13.22.0 seems to solve the issue (but it uses older firebase-admin and firebase-functions packages).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions