Trying to deploy my Firebase function with the command
firebase deploy --only functions:nextServer
results in an error:
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
i functions: preparing codebase default for deployment
i functions: Loaded environment variables from .env.
i functions: preparing . directory for uploading...
i functions: packaged /Users/tony/programming/options-outcry (87.22 MB) for uploading
✔ functions: . folder uploaded successfully
i functions: updating Node.js 16 function nextServer(us-central1)...
Build failed: npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @mui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0a797e73666f794a3f243b3a2439">[email protected]</a>
npm ERR! Found: @types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="691b0c080a1d295851475947585e">[email protected]</a>
npm ERR! node_modules/@types/react
npm ERR! dev @types/react@"18.0.17" from the root project
npm ERR! peerOptional @types/react@"^17.0.0 || ^18.0.0" from @mui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="157774667055203b253b25387479657d743b2c20">[email protected]</a>
npm ERR! node_modules/@mui/base
npm ERR! @mui/base@"5.0.0-alpha.95" from @mui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e131f0a1b0c171f123e4b504f4e504d">[email protected]</a>
npm ERR! node_modules/@mui/material
npm ERR! @mui/material@"^5.10.0" from the root project
npm ERR! 1 more (@mui/icons-material)
npm ERR! 10 more (@mui/icons-material, @mui/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @types/react@"^17.0.0" from @mui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8af9fef3e6eff9cabfa4bbbaa4b9">[email protected]</a>
npm ERR! node_modules/@mui/styles
npm ERR! @mui/styles@"^5.9.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1466717577605425233a243a202d">[email protected]</a>
npm ERR! node_modules/@types/react
npm ERR! peerOptional @types/react@"^17.0.0" from @mui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e4d4a47525b4d7e0b100f0e100d">[email protected]</a>
npm ERR! node_modules/@mui/styles
npm ERR! @mui/styles@"^5.9.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /www-data-home/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /www-data-home/.npm/_logs/2022-09-04T21_53_24_874Z-debug-0.log; Error ID: beaf8772
Researching how to resolve ERESOLVE
errors led me to adding the --legacy-peer-deps
flag to the npm install
command in general cases.
But since the installation is part of the Firebase functions' deployment process, I haven't found a way to include this flag (through firebase.json
or any other means).
Is there a solution to this build error that only arises during Firebase deployment?