Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "express --paas heroku" option which adds package.json entries for heroku deployment to work out-of-the-box #1483

Conversation

curious-attempt-bunny
Copy link

I keep having to copy and paste the correct engines settings for package.json before deploying a new app to heroku. This pull request will make that easier. Simple code, although I may have over-thought the generality of the --paas switch.

----------------- Prior to this pull request the first deploy experience is as follows:

-----> Node.js app detected
-----> Resolving engine versions

   WARNING: No version of Node.js specified in package.json, see:
   https://devcenter.heroku.com/articles/nodejs-versions

   WARNING: The default version of Node.js and npm on Heroku will begin
   tracking the latest stable release starting September 1, 2012.

   Using Node.js version: 0.4.7
   Using npm version: 1.0.106

-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm ERR! error installing express@3.0.6 Error: Unsupported
npm ERR! error installing express@3.0.6 at checkEngine (/tmp/node-npm-5DgI/lib/install.js:493:14)
npm ERR! error installing express@3.0.6 at Array.0 (/tmp/node-npm-5DgI/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! error installing express@3.0.6 at LOOP (/tmp/node-npm-5DgI/node_modules/slide/lib/chain.js:15:13)
npm ERR! error installing express@3.0.6 at chain (/tmp/node-npm-5DgI/node_modules/slide/lib/chain.js:20:4)
npm ERR! error installing express@3.0.6 at installOne_ (/tmp/node-npm-5DgI/lib/install.js:470:3)
npm ERR! error installing express@3.0.6 at installOne (/tmp/node-npm-5DgI/lib/install.js:411:3)
npm ERR! error installing express@3.0.6 at /tmp/node-npm-5DgI/lib/install.js:347:9
npm ERR! error installing express@3.0.6 at /tmp/node-npm-5DgI/node_modules/slide/lib/async-map.js:54:35
npm ERR! error installing express@3.0.6 at Array.forEach (native)
npm ERR! error installing express@3.0.6 at /tmp/node-npm-5DgI/node_modules/slide/lib/async-map.js:54:11
npm ERR! error rolling back express@3.0.6 Error: ENOTEMPTY, Directory not empty '/tmp/build_2tgwfkdt0s1k3/node_modules/express'
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: connect@2.7.2
npm ERR! Required: {"node":">= 0.5.0"}
npm ERR! Actual: {"npm":"1.0.106","node":"0.4.7"}

…for heroku deployment to work out-of-the-box
@@ -21,6 +21,7 @@ program
.option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')
.option('-H, --hogan', 'add hogan.js engine support')
.option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')
.option('-p, --paas [platform]', 'add <platform> support (heroku) (defaults to generic support)')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// generate with heroku support
express -p
express --paas

// generates with heroku support
express -p heroku
express --paas heroku
express -p heroku path/to/my/app
express --paas heroku path/to/my/app

// fail to generate in surprising ways (they write to the current directory)
express -p path/to/my/app
express --paas path/to/my/app

This is because this line in bin/express consumes it:

var path = program.args.shift() || '.';

Thoughts?

@shesek
Copy link
Contributor

shesek commented Jan 25, 2013

I add the engines definition to non-Heroku projects too. Maybe a separate --engines instead? Or even just enable it by default? And perhaps it should add node/npm with the locally installed version, rather than hard-coding it?

Also, what about Procfile?

@curious-attempt-bunny
Copy link
Author

@shesek Yes. --engines is a much better idea. I wasn't sure about non-heroku environments. I'll make that change.

The Procfile isn't necessary as heroku will pick up the start script from the package.json.

@curious-attempt-bunny
Copy link
Author

I'm closing this pull request now that I've superseeded it with this pull request: #1486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants