Strange build behavior during vercel deploy
Unanswered
Chinese Alligator posted this in #help-forum
Chinese AlligatorOP
I have a yarn subproject (Firebase functions) it is separate project in separate folder. Parent folder - is ordinary NextJS 14.0.2 project.
Local build is fine.
But when i push to github, Vercel tries to build and deploy and fail because it try to build nested project, fail to find dependencies.
Project github https://github.com/artemu78/events-n-feedbacks
Nested project https://github.com/artemu78/events-n-feedbacks/tree/main/functions
Vercel project https://vercel.com/areva1/events-n-feedbacks/61fEW4RoejBJFUMVE6aLV37B8wZq#L51
Build command
Build log from vercel logs
As you can see build tries to build nested project, and fail to find dependency.
What can i do? Why behavior is different locally and in the Vercel cloud?
Local build is fine.
But when i push to github, Vercel tries to build and deploy and fail because it try to build nested project, fail to find dependencies.
Project github https://github.com/artemu78/events-n-feedbacks
Nested project https://github.com/artemu78/events-n-feedbacks/tree/main/functions
Vercel project https://vercel.com/areva1/events-n-feedbacks/61fEW4RoejBJFUMVE6aLV37B8wZq#L51
Build command
yarn run buildBuild log from vercel logs
Failed to compile.
./functions/src/auth.ts:2:25
Type error: Cannot find module 'firebase-functions/logger' or its corresponding type declarations.
1 | import * as admin from 'firebase-admin';
> 2 | import * as logger from 'firebase-functions/logger';
| ^
3 | import { Request, Response } from 'firebase-functions/v1';
4 |
5 | import { COOKIE_NAME } from './const';
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
120ms selected
Error: Command "yarn run build" exited with 1As you can see build tries to build nested project, and fail to find dependency.
What can i do? Why behavior is different locally and in the Vercel cloud?
1 Reply
Chinese AlligatorOP
I will answer myself, for some reason dependency was not listed in package.json, but it was present in node_modules of parent project.
So solution is simple - add dpendency in parent package.json
So solution is simple - add dpendency in parent package.json