DEV Community

Muhammad
Muhammad

Posted on

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

*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!

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git