Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Git dependencies with npm and Node on Heroku

I have this package.json file:

{     "name": "application-name"   , "version": "0.0.1"   , "private": true   , "dependencies": {       "coffee-script": "1.1.3"     , "express": "2.5.0"     , "less": "1.1.5"     , "jade": "0.17.0"     , "connect-redis": "1.2.0"     , "hiredis": "0.1.13"     , "redis": "0.7.1"     , "bcrypt": "0.4.1"     , "promised-io": "0.3.0"     , "jugglingdb": "git://github.com/juggy/jugglingdb.git#master"     , "nodemailer": "0.2.3"   } } 

and I want to deploy to Heroku. It works fine locally with npm version 1.0.105, but it chokes on Heroku (I updated the npm there to 1.0.105 as well):

   -----> Heroku receiving push    -----> Fetching custom build pack... done    -----> Node.js app detected    -----> Fetching Node.js binaries    -----> Vendoring node 0.4.7    -----> Installing dependencies with npm 1.0.105           npm ERR! git checkout master fatal: Not a git repository: '.'           npm ERR! Error: `git "checkout" "master"` failed with 128           npm ERR!     at ChildProcess.<anonymous> (/tmp/node-npm-Jb2d/lib/utils/exec.js:49:20)           npm ERR!     at ChildProcess.emit (events.js:67:17)           npm ERR!     at ChildProcess.onexit (child_process.js:192:12)           npm ERR! Report this *entire* log at:           npm ERR!     <http://github.com/isaacs/npm/issues>           npm ERR! or email it to:           npm ERR!     <[email protected]>           npm ERR!            npm ERR! System Linux 2.6.32-316-ec2           npm ERR! command "/tmp/node-node-C3jD/bin/node" "/tmp/node-npm-Jb2d/cli.js" "install"           npm ERR! cwd /tmp/build_2yzg7lk83o5m9           npm ERR! node -v v0.4.7           npm ERR! npm -v 1.0.105           npm ERR! git checkout master fatal: Not a git repository: '.'           npm ERR!            npm ERR! Additional logging details can be found in:           npm ERR!     /tmp/build_2yzg7lk83o5m9/npm-debug.log           npm not ok     !     Failed to install dependencies with npm     !     Heroku push rejected, failed to compile Node.js app  

Also, I do not seem to find a way to get access to that log file in /tmp.

As anyone succeed deploying a Git dependency on Heroku (works fine on ruby side :P) ?

like image 937
Julien Avatar asked Nov 23 '11 14:11

Julien


People also ask

Does Heroku install dependencies?

By default, Heroku will install all dependencies listed in package. json under dependencies and devDependencies . After running the installation and build steps Heroku will strip out the packages declared under devDependencies before deploying the application.

Should I include node_modules in Heroku?

I am the Node language owner at Heroku and the answer is simple: No. Do not check node_modules in to Heroku apps.

Does Heroku run npm build?

By default, Heroku runs npm start while starting deployed Node.

How run npm install on Heroku CLI?

Run the npm install command in your local app directory to install the dependencies that you declared in your package. json file. Start your app locally using the heroku local command, which is installed as part of the Heroku CLI. Your app should now be running on http://localhost:5000/.


2 Answers

FYI if its on GitHub you can just specify the username/repository and npm will do the rest.

{     "name": "application-name"   , "version": "0.0.1"   , "private": true   , "dependencies": {       "coffee-script": "1.1.3"     , "express": "2.5.0"     , "less": "1.1.5"     , "jade": "0.17.0"     , "connect-redis": "1.2.0"     , "hiredis": "0.1.13"     , "redis": "0.7.1"     , "bcrypt": "0.4.1"     , "promised-io": "0.3.0"     , "jugglingdb": "juggy/jugglingdb"     , "nodemailer": "0.2.3"   } } 

Alternatively

Specify one of (git/git+ssh/git+http/git+https)://user@host/repo.git urls

Fully documented

like image 156
Matej Avatar answered Sep 30 '22 21:09

Matej


I don't know about this package, but I've got others to work with syntax like the following. On heroku, using a http reference to a tar.gz

package.json:

{     "name": "application-name"   , "version": "0.0.1"   , "private": true   , "dependencies": {       "coffee-script": "1.1.3"     , "express": "2.5.0"     , "less": "1.1.5"     , "jade": "0.17.0"     , "connect-redis": "1.2.0"     , "hiredis": "0.1.13"     , "redis": "0.7.1"     , "bcrypt": "0.4.1"     , "promised-io": "0.3.0"     , "jugglingdb": "https://github.com/juggy/jugglingdb/tarball/master"     , "nodemailer": "0.2.3"   } } 
like image 39
Derek Bredensteiner Avatar answered Sep 30 '22 20:09

Derek Bredensteiner