NodeJS Heroku devDependencies在部署期间生成失败

mefy6pfw  于 2023-04-29  发布在  Node.js
关注(0)|答案(2)|浏览(127)

我正在开发一个NestJs后端应用程序,并试图使用Heroku-cli将其部署在Heroku上。一开始,我能够部署和运行它,但在一些依赖项更新后,它一直失败,下面是与问题相关的错误。

remote: -----> Pruning devDependencies
remote:        
remote:        > bcrypt@5.0.1 install node_modules/bcrypt
remote:        > node-pre-gyp install --fallback-to-build
remote:        
remote:        sh: 1: node-pre-gyp: not found
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! syscall spawn
remote:        npm ERR! file sh
remote:        npm ERR! errno ENOENT
remote:        npm ERR! bcrypt@5.0.1 install: `node-pre-gyp install --fallback-to-build`
remote:        npm ERR! spawn ENOENT
remote:        npm ERR! 
remote:        npm ERR! Failed at the bcrypt@5.0.1 install script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.YhodU/_logs/2022-04-06T09_19_17_828Z-debug.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
remote: Verifying deploy...
remote: 
remote: !       Push rejected to d....y-e....s.
remote: 
To https://git.heroku.com/d....y-e....s.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/d....y-e....s.git'

以前有人遇到过这个问题吗?如果是,我应该处理吗?

PS:我已经隐藏了URL,因为该项目是私人的。

11dmarpk

11dmarpk1#

我在包里添加了NPM版本。json文件,它解决了这个问题。

guz6ccqo

guz6ccqo2#

嗨如果你可以在本地环境中安装依赖项,请尝试这个
1.转到Heroku上的应用程序设置。
1.单击“显示配置变量”。
1.添加为密钥:NPM_CONFIG_LEGACY_PEER_DEPS:真的。
1.展开

相关问题