首先,我想將我的所有檔案推送到 heroku 以進行托管,在這里我無法在 heroku 上安裝 multer 和 multer-gridfs-storage 的依賴項,這就是為什么我無法在 heroku 上托管我的網站
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE could not resolve
remote: npm ERR!
remote: npm ERR! While resolving: multer-gridfs-storage@5.0.2
remote: npm ERR! Found: multer@1.4.5-lts.1
remote: npm ERR! node_modules/multer
remote: npm ERR! multer@"^1.4.5-lts.1" from the root project
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer multer@"^1.4.2" from multer-gridfs-storage@5.0.2
remote: npm ERR! node_modules/multer-gridfs-storage
remote: npm ERR! multer-gridfs-storage@"^5.0.2" from the root project
remote: npm ERR!
remote: npm ERR! Conflicting peer dependency: multer@1.4.4
remote: npm ERR! node_modules/multer
remote: npm ERR! peer multer@"^1.4.2" from multer-gridfs-storage@5.0.2
remote: npm ERR! node_modules/multer-gridfs-storage
remote: npm ERR! multer-gridfs-storage@"^5.0.2" from the root project
remote: npm ERR!
remote: npm ERR! Fix the upstream dependency conflict, or retry
remote: npm ERR! this command with --force, or --legacy-peer-deps
remote: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote: npm ERR!
remote: npm ERR! See /tmp/npmcache.fbHb6/eresolve-report.txt for a full report.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.fbHb6/_logs/2022-10-22T21_00_27_665Z-debug-0.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
uj5u.com熱心網友回復:
-lts.1后綴 onmulter@"^1.4.5-lts.1"導致它不與來自 的對等版本^1.4.2約束匹配[email protected]。根據npm semver 計算器,滿足此版本約束的 Multer 的最新版本是1.4.4.
鑒于該版本1.4.5-lts.1似乎是 1.x 開發線的兼容延續,并且 Multer 存在于 NPM 生態系統中,我認為這是 Multer 專案中的一個錯誤1。它的版本號應該滿足 NPM 對 semver 的理解。
您最簡單的解決方案是將您對 Multer 的直接依賴從 version 減少^1.4.5-lts.1到 version 1.4.4,這滿足了 Multer GridFS Storage 的對等依賴。希望您不依賴新版本中的任何功能或錯誤修復。
我已經針對 Multer 專案提交了一個錯誤,表明它的 LTS 版本約束仍然與 semver 兼容,假設該1.4.5-lts.1版本實際上應該與版本1.4.4和更早版本兼容。
1我在 semver 或 NPM 方面知識不足,無法知道此實作是否真正正確。重要的是 Multer 專案和 NPM 的 semver 實作似乎存在沖突。
我相信-lts.1后綴被認為是預發行版(即1.4.4-lts.1會出現在 之前 1.4.4)。semver 計算器似乎同意:使用>=1.4.2 <=1.4.4-lts.1匹配版本1.4.2、、1.4.3和1.4.4-lts.1、但不 1.4.4匹配的版本約束。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/519353.html
標籤:节点.jsheroku依赖关系穆尔特multer-gridfs-存储
