Reputation: 2621
I have a sails js app I am trying launch on a heroku server. From what I can tell, the heroku app is installing ruby and not node by default.
I have a bower.json file, a package.json file and a Procfile.
ERROR:
Starting process with command `node app.js`
bash: node: command not found
Procfile:
web: node app.js
Package.json:
{
"name": "app",
"private": true,
"version": "0.0.1",
"dependencies": {
"node": "*",
"sails": "~0.10.5",
"sails-disk": "~0.10.0",
"request": "^2.51.0",
"node-fullbox-api": "*",
"stripe": "*",
"rc": "~0.5.0",
"bower": "^1.3.9",
"grunt": "^0.4.5",
"grunt-banner": "^0.2.3",
"grunt-bower": "^0.14.0",
"grunt-bowercopy": "^1.1.0",
"grunt-concurrent": "^0.5.0",
"grunt-config-dir": "^0.3.2",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-compass": "^0.8.0",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-connect": "^0.8.0",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-imagemin": "^0.7.2",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-requirejs": "^0.4.4",
"grunt-contrib-watch": "^0.6.1",
"grunt-githooks": "^0.3.1",
"grunt-jscs": "^0.6.2",
"grunt-lodash": "^0.4.0",
"grunt-modernizr": "^0.5.2",
"grunt-newer": "^0.7.0",
"grunt-scss-lint": "^0.3.3",
"grunt-string-replace": "^1.0.0",
"grunt-stripmq": "0.0.6",
"grunt-svgmin": "^0.4.0",
"jquery-builder": "^0.7.0",
"jshint-stylish": "^0.4.0",
"lodash": "^1.3.1",
"lodash-cli": "^3.1.0",
"rjs-build-analysis": "0.0.3",
"time-grunt": "^0.3.2",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-jst": "~0.6.0",
"grunt-contrib-less": "0.11.1",
"grunt-contrib-uglify": "~0.4.0",
"grunt-sails-linker": "~0.9.5",
"grunt-sync": "~0.0.4",
"include-all": "~0.1.3",
"underscore": "^1.7.0"
},
"scripts": {
"postinstall": "node npm-postinstall.js"
},
"main": "app.js",
"scripts": {
"start": "node app.js",
"debug": "node debug app.js"
},
"devDependencies": {
"mkdirp": "^0.5.0",
"shortid": "^2.1.3",
"node": "*"
},
"engines": {
"node": "*",
"npm": "*",
"ruby": "*"
}
}
As for testing: I can run heroku local and if fires up a server just fine. npm start and npm install work just fine. node app.js starts the app just fine.
What I have found is that when I connect to heroku via: heroku run bash
I get a command line that I can run these:
~ $ which ruby
/app/bin/ruby
~ $ npm install
bash: npm: command not found
~ $ bower install
bash: bower: command not found
~ $ which git
/usr/bin/git
What am I doing wrong?! Thanks!
Upvotes: 2
Views: 3988
Reputation: 2621
Okay I found my answer. Every time I pushed new code it would say:
remote: -----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby, Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
Paired with it saying that node command not found
, I was able to track down that heroku has a default order in which it detects server types for an install. In this case it was ruby.
I found the answer here: Heroku wrongly detecting my Node app as a Ruby app
Which was to do this:
$ heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs
$ git commit -am "empty" --allow-empty
$ git push heroku master
Upvotes: 8