I have been developing this app for quite a long time yet, and after reading the console warning about an outdated version of firebase-functions and that I should upgrade to latest version I finally made the decision to update. Now, even though everything seems to be working properly, I am unable to run npm run build successfully when testing on the emulator, since I get a lot of error messages related to a package inside my node_modules folder.
I am running the local emulator where all the new code is tested before being deployed into production. And this is what these two packages looked like on my package.json file looked before and after updating:
Before
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.22.0",
After
"firebase-admin": "^10.0.2",
"firebase-functions": "^4.0.0",
The problem
After updating, I am unable to successfully run npm run build, and I get a bunch of error related with packages that are inside node_modules. Some of this packages are:
node_modules/@firebase/util/dist/
node_modules/@types/express-serve-static-core
node_modules/firebase-functions/lib/common
And the errors are not that verbose and go something like this:
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
I'll be attaching a screenshot with some of the errors I'm getting.
What have I Already tried doing
- Installed latest version of firebase-functions: Updated onlyfirebase-functionswithnpm install --save firebase-functions@latestinside myfunctionsdirectory.- This resulted on a dependency conflict with functionsandfirebase-adminpackage as discussed on this question
 
- This resulted on a dependency conflict with 
- Installed latest version of firebase-admin: Solved the dependency issue by runningnpm install --save firebase-admin@latestand by installing latest version offirebase-functions.- This solved the conflict but this is where the issues started appearing after running npm run build
- I also got a bunch of new errors that resulted from the upgrade, but I solved them and everything seems to be working OK.
 
- This solved the conflict but this is where the issues started appearing after running 
- Removed node_modules,package-lock.json: In order to properly re-install dependencies, erased these two files and runnpm install, but the problem persisted.
- Upgraded to specific versions of functions and admin: While diving deeply on this rabbit hole, I noticed that perhaps upgrading to a specific version could help. So I went with firebase-admin@10.0.0andfirebase-functions@4.0.0. But nothing.
So, What am I looking for?
My workflow is as follows:
- Write new code
- Run npm run buildto see if everything is ok and the app passes the linter test at a quick glance
- Test code
- Push Code
- ...
- npm run lintbefore deploy (which passes)
- Deploy
So, for me npm run build tells me that everything is OK and I can move forward with code. I don't really know if this is necessary or not, but I've been working like this forever. It gives me a safe feeling.
So I want to know why can't I run npm run build, what is causing all these errors that I have nothing to do with, and how can I solve this issue.
I am also afraid that this will impact on the deploy of functions, preventing me from deploying correctly since npm run build is not passing.
My Project settings
- firebase-functions: 3.20.1
- firebase-tools: 11.16.1
- firebase-admin: 10.1.0
- Language: Typescript
- Node Version: 14.21.1 (using with nvm)

 
    