How to deploy a node app on Heroku which uses 'pnpm' as its package manager instead of 'npm'?

Muhammad - Jan 28 '23 - - Dev Community

*Short answer:-
*

You have to install a third-party buildpack which can run pnpm commands from Heroku Elements e.g. https://elements.heroku.com/buildpacks/unfold/heroku-buildpack-pnpm

*Long answer:-
*

Normally, developers use "npm" as a package manager for their NodeJS apps.

However there is a new package manager in the market getting popular called "pnpm" (https://pnpm.io).

If you use "pnpm" instead of "npm" and want to deploy your NodeJS app to Heroku, the deployment will fail because the Heroku buildpack which runs the "install" command to start the deployment does it by assuming "npm" as your package manager.

As of 28-Jan-2023, Heroku's official NodeJS buildpack does not support the "pnpm" package manager, so you will have to add a third-party buildpack like this one:- https://elements.heroku.com/buildpacks/unfold/heroku-buildpack-pnpm

You can add the third-party buildpack through the dashboard or through your Terminal.

Wishing you success!

. . . . . . . . . . . . . . . . . . . .