heroku 使用multer和multer-gridfs-storage的依赖性问题

uqzxnwby  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(180)

首先,我想把我的所有文件到heroku托管的目的,在这里,我不能安装依赖的multer和multer-gridfs-storage heroku,所以这就是为什么我不能在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
sqyvllje

sqyvllje1#

multer@"^1.4.5-lts.1"上的-lts.1后缀导致它与来自multer-gridfs-storage@5.0.2的对等版本约束^1.4.2不匹配。根据npm semver calculator,满足此版本约束的Multer的最新版本是1.4.4
考虑到version 1.4.5-lts.1 appears to be a compatible continuation of the 1.x development line,以及Multer存在于NPM生态系统中,我认为这是Multer项目中的一个bug ¹。
最简单的解决方案是将对Multer的直接依赖从版本^1.4.5-lts.1降低到版本1.4.4,这满足了Multer GridFS Storage的对等依赖。希望您不会依赖新版本中的任何特性或bug修复。
我已经提交了a bug against the Multer project,建议它的LTS版本约束保持与semver兼容,假设1.4.5-lts.1版本实际上应该与1.4.4和更早的版本兼容。
¹我对semver或NPM的了解不够,不知道这个实现是否正确,重要的是Multer项目和NPM对semver的实现似乎是冲突的。
我相信后缀-lts.1被认为是预发布版本(即,1.4.4-lts.1会出现在 * 1.4.4之前)。使用>=1.4.2 <=1.4.4-lts.1的版本限制符合1.4.21.4.31.4.4-lts.1版本,但 * 不符合 * 1.4.4版本。

相关问题