Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku bash: node: command not found

Have someone out there got this error when starting a node app on heroku before?

2012-10-17T20:28:52+00:00 heroku[web.1]: Starting process with command `node app.js`
2012-10-17T20:28:53+00:00 app[web.1]: bash: node: command not found

It seems like the Heroku app are missing node.

The app starts just fine locally. Both foreman start and node app.js.

{
    "name": "app-name",
    "description": "some desc",
    "version": "0.0.1",
    "private": true,
    "engines": {
        "node": "0.8.12",
        "npm":  "1.1.49"
    },
    "dependencies": {
        "express" : "2.5.9",
        "mongoose" : ">=2.6.0",
        "colibri" : "*",
        "jade": ">= 0.0.1"
    }
}
like image 551
hinderberg Avatar asked Oct 17 '12 20:10

hinderberg


4 Answers

What fixed it for me was to add the heroku/nodejs buildpack in heroku settings.

like image 140
M3NTA7 Avatar answered Nov 10 '22 22:11

M3NTA7


Old question, but, try adding an engines section to your package.json:

"engines": {
    "node": ">= 6.9.4",
    "npm": ">= 4.4.0"
  }
like image 36
transistor Avatar answered Nov 11 '22 00:11

transistor


First, ensure that your application is using the heroku/nodejs buildpack:

$ heroku buildpacks
  1. heroku/nodejs

If this is not the case then change your builpack to nodejs using :

$ heroku buildpacks:set heroku/nodejs

Image of terminal

like image 4
Diptesh Chakraborty Avatar answered Nov 10 '22 22:11

Diptesh Chakraborty


Heroku recognizes an app as Node.js by the existence of a package.json. Even if your app has no dependencies, you should still create a package.json that declares a name, version, and empty dependencies in order that it appear as a Node app.

https://devcenter.heroku.com/articles/nodejs

like image 2
Colonel Panic Avatar answered Nov 10 '22 22:11

Colonel Panic