Search code examples
javanode.jsherokunpmterser

Heroku build fails because npm is missing


I am using terser as a minification step in a gradle task. But heroku does not have the npm binary during the build.

This is what i tried

val installTerser = tasks.create<Exec>("installTerser") {
    commandLine("npm", "install", "-g", "terser")
}

Is there a way to install a executable into the repository, so i can use it without the need for npm in heroku ?

Or how can i tell heroku that i need both java and nodejs tools ?


Solution

  • Add the Node.js buildpack to your app by running:

    $ heroku buildpacks:add -i 1 heroku/nodejs 
    

    Then redeploy.