Heroku bash:node:找不到命令

在Heroku上启动节点应用程序之前,有没有人有这个错误?

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 

似乎Heroku应用程序缺less节点。

该应用程序本地启动就好了。 领class开始和节点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" } } 

Heroku通过package.json的存在将应用识别为Node.js。 即使您的应用程序没有依赖关系,也应该创build一个声明名称,版本和空依赖关系的package.json,以使其显示为Node应用程序。

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

tl; dr:碰到同样的问题, heroku restart为我工作。


长版:这是如何去的:

  1. heroku logs我看到:

     heroku[slugc]: Slug compilation finished heroku[web.1]: Starting process with command `node app.js` app[web.1]: bash: node: command not found heroku[web.1]: Process exited with status 127 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path=/ host=node-network.herokuapp.com fwd=70.28.80.4 dyno= queue= wait= connect= service= status=503 bytes= heroku[web.1]: State changed from starting to down 
  2. 所以我跑了heroku restart ,并得到:

     heroku[web.1]: State changed from down to starting heroku[web.1]: Starting process with command `node app.js` app[web.1]: Listening on port 30693 heroku[web.1]: State changed from starting to up 

为我修复的是在heroku设置中添加heroku / nodejs buildpack。

老问题,但是,尝试添加一个engines部分到你的package.json

 "engines": { "node": ">= 6.9.4", "npm": ">= 4.4.0" }