'Heroku devDependencies build failing during deployment

I am working on a NestJs backend app and trying to deploy it on Heroku with Heroku-cli. At the beginning, I was able to deploy and run it but after some dependencies update, it keeps failing and below is the error related to the issue.

remote: -----> Pruning devDependencies
remote:        
remote:        > [email protected] 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! [email protected] install: `node-pre-gyp install --fallback-to-build`
remote:        npm ERR! spawn ENOENT
remote:        npm ERR! 
remote:        npm ERR! Failed at the [email protected] 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'

Is someone already meet this issue before ? If yes, should I deal with it ?

PS: I have hidden the URL because the project is private.



Solution 1:[1]

I added NPM version inside the package.json file, and it solved the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cedric Achi