![](/img/trans.png)
[英]How can I fix command line error supportedNodeVersions when deploying Firebase cloud functions?
[英]How to fix "ERESOLVE could not resolve" when deploying firebase functions
当我使用firebase deploy --only functions:nextServer
部署我的 firebase function 时,出现如下错误:
✔ 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/styles@5.10.3
npm ERR! Found: @types/react@18.0.17
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/base@5.0.0-alpha.95
npm ERR! node_modules/@mui/base
npm ERR! @mui/base@"5.0.0-alpha.95" from @mui/material@5.10.3
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/styles@5.10.3
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/react@17.0.49
npm ERR! node_modules/@types/react
npm ERR! peerOptional @types/react@"^17.0.0" from @mui/styles@5.10.3
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
我搜索了一般如何修复ERESOLVE
错误,大多数答案告诉我将--legacy-peer-deps
标志添加到npm install
命令。
但是,此处发生的安装发生在 firebase 函数的部署过程中,我没有找到任何允许我添加此标志的东西(通过firebase.json
或任何其他方法)。
我该如何修复此构建错误,它仅在我部署到 firebase 时发生?
我遇到了这个问题,并通过在 firebase.json 的"functions"
部分中添加firebase.json
标志来解决它:
"functions": {
"source": ".",
"predeploy": [
"npm --prefix \"$PROJECT_DIR\" install --legacy-peer-deps",
"npm --prefix \"$PROJECT_DIR\" run build --legacy-peer-deps"
],
"runtime": "nodejs14"
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.