Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

deploy rendertron on heroku #90

Closed
hekod777 opened this issue Aug 30, 2017 · 10 comments
Closed

deploy rendertron on heroku #90

hekod777 opened this issue Aug 30, 2017 · 10 comments

Comments

@hekod777
Copy link

I was trying to deploy my own rendertron docker container to heroku.

  1. the docker image was successfully built

  2. heroku container:push web was successful as well

  3. but when I visit the site. It gives an error. this is what i saw in the heroku logs

2017-08-30T20:03:01.757158+00:00 app[web.1]: npm ERR! 
2017-08-30T20:03:01.756957+00:00 app[web.1]: npm ERR! Exit status 1
2017-08-30T20:03:01.757338+00:00 app[web.1]: npm ERR! Failed at the bot-render@1.0.0 start script.
2017-08-30T20:03:01.757499+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-08-30T20:03:01.759830+00:00 app[web.1]: 
2017-08-30T20:03:01.760064+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-08-30T20:03:01.760208+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2017-08-30T20_03_01_736Z-debug.log
2017-08-30T20:03:01.879956+00:00 heroku[web.1]: State changed from starting to crashed
2017-08-30T20:03:01.863596+00:00 heroku[web.1]: Process exited with status 1
2017-08-30T21:34:34.105177+00:00 heroku[web.1]: State changed from crashed to starting
2017-08-30T21:34:38.107376+00:00 heroku[web.1]: Starting process with command `npm start`
2017-08-30T21:34:41.628993+00:00 app[web.1]: 
2017-08-30T21:34:41.629007+00:00 app[web.1]: > bot-render@1.0.0 start /app
2017-08-30T21:34:41.629008+00:00 app[web.1]: > node src/main.js
2017-08-30T21:34:41.629009+00:00 app[web.1]: 
2017-08-30T21:34:43.153366+00:00 app[web.1]: Error: The environment variable CHROME_PATH must be set to executable of a build of Chromium version 54.0 or later.
2017-08-30T21:34:43.153377+00:00 app[web.1]:     at Object.linux (/app/node_modules/chrome-launcher/chrome-finder.js:105:15)
2017-08-30T21:34:43.153378+00:00 app[web.1]:     at Launcher.<anonymous> (/app/node_modules/chrome-launcher/chrome-launcher.js:109:75)
2017-08-30T21:34:43.153379+00:00 app[web.1]:     at Generator.next (<anonymous>)
2017-08-30T21:34:43.153380+00:00 app[web.1]:     at /app/node_modules/chrome-launcher/chrome-launcher.js:12:71
2017-08-30T21:34:43.153381+00:00 app[web.1]:     at Promise (<anonymous>)
2017-08-30T21:34:43.153381+00:00 app[web.1]:     at __awaiter (/app/node_modules/chrome-launcher/chrome-launcher.js:8:12)
2017-08-30T21:34:43.153382+00:00 app[web.1]:     at Launcher.launch (/app/node_modules/chrome-launcher/chrome-launcher.js:94:16)
2017-08-30T21:34:43.153383+00:00 app[web.1]:     at Object.<anonymous> (/app/node_modules/chrome-launcher/chrome-launcher.js:42:24)
2017-08-30T21:34:43.153383+00:00 app[web.1]:     at Generator.next (<anonymous>)
2017-08-30T21:34:43.153384+00:00 app[web.1]:     at /app/node_modules/chrome-launcher/chrome-launcher.js:12:71
2017-08-30T21:34:43.181613+00:00 app[web.1]: npm ERR! errno 1
2017-08-30T21:34:43.181255+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-08-30T21:34:43.181894+00:00 app[web.1]: npm ERR! bot-render@1.0.0 start: `node src/main.js`
2017-08-30T21:34:43.182157+00:00 app[web.1]: npm ERR! Exit status 1
2017-08-30T21:34:43.182409+00:00 app[web.1]: npm ERR! 
2017-08-30T21:34:43.182705+00:00 app[web.1]: npm ERR! Failed at the bot-render@1.0.0 start script.
2017-08-30T21:34:43.182999+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-08-30T21:34:43.185002+00:00 app[web.1]: 
2017-08-30T21:34:43.185292+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-08-30T21:34:43.185480+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2017-08-30T21_34_43_173Z-debug.log
2017-08-30T21:34:43.290883+00:00 heroku[web.1]: Process exited with status 1
2017-08-30T21:34:43.306186+00:00 heroku[web.1]: State changed from starting to crashed
2017-08-30T22:09:09.923840+00:00 app[api]: Deployed web (fa4a1d371d84) by user sicong.x.he.-nd@disney.com
2017-08-30T22:09:09.923840+00:00 app[api]: Release v4 created by user sicong.x.he.-nd@disney.com
2017-08-30T22:09:10.333913+00:00 heroku[web.1]: State changed from crashed to starting
2017-08-30T22:09:29.900213+00:00 heroku[web.1]: Starting process with command `run start`
2017-08-30T22:09:34.486108+00:00 heroku[web.1]: Process exited with status 1
2017-08-30T22:09:34.359622+00:00 app[web.1]: 
2017-08-30T22:09:34.359638+00:00 app[web.1]: Usage: npm <command>
2017-08-30T22:09:34.359639+00:00 app[web.1]: 
2017-08-30T22:09:34.359640+00:00 app[web.1]: where <command> is one of:
2017-08-30T22:09:34.359641+00:00 app[web.1]:     access, adduser, bin, bugs, c, cache, completion, config,
2017-08-30T22:09:34.359642+00:00 app[web.1]:     ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
2017-08-30T22:09:34.359643+00:00 app[web.1]:     explore, get, help, help-search, i, init, install,
2017-08-30T22:09:34.359643+00:00 app[web.1]:     install-test, it, link, list, ln, login, logout, ls,
2017-08-30T22:09:34.359644+00:00 app[web.1]:     outdated, owner, pack, ping, prefix, prune, publish, rb,
2017-08-30T22:09:34.359644+00:00 app[web.1]:     rebuild, repo, restart, root, run, run-script, s, se,
2017-08-30T22:09:34.359645+00:00 app[web.1]:     search, set, shrinkwrap, star, stars, start, stop, t, team,
2017-08-30T22:09:34.359646+00:00 app[web.1]:     version, view, whoami
2017-08-30T22:09:34.359647+00:00 app[web.1]: 
2017-08-30T22:09:34.359648+00:00 app[web.1]: npm <command> -h     quick help on <command>
2017-08-30T22:09:34.359646+00:00 app[web.1]:     test, tst, un, uninstall, unpublish, unstar, up, update, v,
2017-08-30T22:09:34.359648+00:00 app[web.1]: npm -l           display full usage info
2017-08-30T22:09:34.359649+00:00 app[web.1]: npm help <term>  search for help on <term>
2017-08-30T22:09:34.359650+00:00 app[web.1]: npm help npm     involved overview
2017-08-30T22:09:34.359650+00:00 app[web.1]: 
2017-08-30T22:09:34.359651+00:00 app[web.1]: Specify configs in the ini-formatted file:
2017-08-30T22:09:34.359651+00:00 app[web.1]:     /app/.npmrc
2017-08-30T22:09:34.359652+00:00 app[web.1]: or on the command line via: npm <command> --key value
2017-08-30T22:09:34.359653+00:00 app[web.1]: Config info can be viewed via: npm help config
2017-08-30T22:09:34.359653+00:00 app[web.1]: 
2017-08-30T22:09:34.359654+00:00 app[web.1]: npm@5.3.0 /nodejs/lib/node_modules/npm
2017-08-30T22:09:34.498472+00:00 heroku[web.1]: State changed from starting to crashed
2017-08-30T22:09:34.501309+00:00 heroku[web.1]: State changed from crashed to starting
2017-08-30T22:09:57.722801+00:00 heroku[web.1]: Starting process with command `run start`
2017-08-30T22:10:03.257312+00:00 heroku[web.1]: Process exited with status 1
2017-08-30T22:10:03.148639+00:00 app[web.1]: 
2017-08-30T22:10:03.148651+00:00 app[web.1]: Usage: npm <command>
2017-08-30T22:10:03.148652+00:00 app[web.1]: 
2017-08-30T22:10:03.148652+00:00 app[web.1]: where <command> is one of:
2017-08-30T22:10:03.148653+00:00 app[web.1]:     access, adduser, bin, bugs, c, cache, completion, config,
2017-08-30T22:10:03.148654+00:00 app[web.1]:     ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
2017-08-30T22:10:03.148655+00:00 app[web.1]:     explore, get, help, help-search, i, init, install,
2017-08-30T22:10:03.148655+00:00 app[web.1]:     install-test, it, link, list, ln, login, logout, ls,
2017-08-30T22:10:03.148656+00:00 app[web.1]:     outdated, owner, pack, ping, prefix, prune, publish, rb,
2017-08-30T22:10:03.148656+00:00 app[web.1]:     rebuild, repo, restart, root, run, run-script, s, se,
2017-08-30T22:10:03.148657+00:00 app[web.1]:     search, set, shrinkwrap, star, stars, start, stop, t, team,
2017-08-30T22:10:03.148658+00:00 app[web.1]:     test, tst, un, uninstall, unpublish, unstar, up, update, v,
2017-08-30T22:10:03.148658+00:00 app[web.1]:     version, view, whoami
2017-08-30T22:10:03.148659+00:00 app[web.1]: 
2017-08-30T22:10:03.148660+00:00 app[web.1]: npm <command> -h     quick help on <command>
2017-08-30T22:10:03.148660+00:00 app[web.1]: npm -l           display full usage info
2017-08-30T22:10:03.148661+00:00 app[web.1]: npm help <term>  search for help on <term>
2017-08-30T22:10:03.148661+00:00 app[web.1]: npm help npm     involved overview
2017-08-30T22:10:03.148662+00:00 app[web.1]: 
2017-08-30T22:10:03.148663+00:00 app[web.1]:     /app/.npmrc
2017-08-30T22:10:03.148662+00:00 app[web.1]: Specify configs in the ini-formatted file:
2017-08-30T22:10:03.148664+00:00 app[web.1]: or on the command line via: npm <command> --key value
2017-08-30T22:10:03.148665+00:00 app[web.1]: 
2017-08-30T22:10:03.148665+00:00 app[web.1]: Config info can be viewed via: npm help config
2017-08-30T22:10:03.148666+00:00 app[web.1]: npm@5.3.0 /nodejs/lib/node_modules/npm
2017-08-30T22:10:03.272913+00:00 heroku[web.1]: State changed from starting to crashed
2017-08-30T22:10:03.938038+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=infinite-forest-14908.herokuapp.com request_id=2523fa4f-cade-45fa-b20b-bcfcd9c44e16 fwd="204.128.192.32" dyno= connect= service= status=503 bytes= protocol=https
2017-08-30T22:10:05.126246+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=infinite-forest-14908.herokuapp.com request_id=4d265f87-bc97-416f-b71c-b678d8c635c3 fwd="204.128.192.32" dyno= connect= service= status=503 bytes= protocol=https
2017-08-30T22:10:06.284586+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=infinite-forest-14908.herokuapp.com request_id=9774d6aa-7144-40c4-8410-d26a0284f4a6 fwd="204.128.192.32" dyno= connect= service= status=503 bytes= protocol=https

I am a total newbie in terms of docker.

I'd like to know what went wrong.

thx!

@justinribeiro
Copy link
Contributor

Before you pushed the container to heroku, did it run without errors locally? Based on the error message, I'm wondering if did indeed build (it shouldn't be throwing the CHROME_PATH error).

I don't generally use heroku, but everything about the container should be fine based on heroku's requirements. I'll spin up a test account and see if I can get it to work.

@hekod777
Copy link
Author

I was able to run the docker container successfully by using

docker run -it -p 8080:8080 --cap-add SYS_ADMIN --name rendertron-container rendertron

the image should be fine

@justinribeiro
Copy link
Contributor

justinribeiro commented Sep 14, 2017

@hekod777 Cool, appreciate the verification. Let me see if I can scope out what Heroku is doing when it pushes to their container repository.

@hekod777
Copy link
Author

hekod777 commented Sep 22, 2017

@justinribeiro Had the same error when I tried to runnpm start in an AWS ec2 instance.

After install chrome as ec2-user, the error was gone

But I got another error after npm start

bot-render@1.0.0 start /home/ec2-user/rendertron
node src/main.js

{ Error: connect ECONNREFUSED 127.0.0.1:33465
at Object._errnoException (util.js:1026:11)
at _exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 33465 }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bot-render@1.0.0 start: node src/main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bot-render@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

These two lines will appear first

bot-render@1.0.0 start /home/ec2-user/rendertron
node src/main.js

then the error will came up in about 8 secs

after some digging, the root of the problem is thats the in chrome-launcher isDebuggerReady() is calling net.createConnection(this.port); which keeps failing.

any ideas what might be the problem?

The purpose of npm start instead of running docker container

running docker container will result in a very poor performance. I am trying to use npm start to start rendertron and see if it can perform better.

Reproduction steps

  1. start an AWS ec2 instance with AMI

  2. connect to the ec2 instance

  3. install git sudo yum install git

  4. pull rendertron repo

git clone https://github.com/GoogleChrome/rendertron.git

  1. install chrome

sudo yum --nogpgcheck localinstall https://intoli.com/blog/installing-google-chrome-on-centos/google-chrome-stable-60.0.3112.113-1.x86_64.rpm

  1. cd into rendertron folder

cd rendertron

  1. npm install

  2. npm start

Tried work arounds

  • comment out yield this.waitUntilReady(); in chrome-launcher.js in the spawnProcess function. Rendertron was able to run, but if I try to render a page, it will give the following error.

Uncaught exception
{ Error: connect ECONNREFUSED 127.0.0.1:38585
at Object._errnoException (util.js:1026:11)
at _exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 38585 }

  • Increase the pollInterval to 50000ms. And simply the same result.
    net.createConnection() simply throws ECONNREFUSED error as soon as it tries to create a connection.

@icarv
Copy link

icarv commented Sep 26, 2017

i'm getting a similar stack trace when trying to push to heroku, no mention of the CHROME_PATH in the logs for me tho and it deploys fine locally

2017-09-26T20:05:48.573836+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-26T20:06:06.282687+00:00 heroku[web.1]: Starting process with command `run start`
2017-09-26T20:06:09.241688+00:00 heroku[web.1]: Process exited with status 1
2017-09-26T20:06:09.253670+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-26T20:06:09.255325+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-26T20:06:09.160736+00:00 app[web.1]: 
2017-09-26T20:06:09.160751+00:00 app[web.1]: Usage: npm 
2017-09-26T20:06:09.160752+00:00 app[web.1]: 
2017-09-26T20:06:09.160753+00:00 app[web.1]: where  is one of:
2017-09-26T20:06:09.160754+00:00 app[web.1]:     ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
2017-09-26T20:06:09.160753+00:00 app[web.1]:     access, adduser, bin, bugs, c, cache, completion, config,
2017-09-26T20:06:09.160755+00:00 app[web.1]:     explore, get, help, help-search, i, init, install,
2017-09-26T20:06:09.160755+00:00 app[web.1]:     install-test, it, link, list, ln, login, logout, ls,
2017-09-26T20:06:09.160756+00:00 app[web.1]:     outdated, owner, pack, ping, prefix, prune, publish, rb,
2017-09-26T20:06:09.160756+00:00 app[web.1]:     rebuild, repo, restart, root, run, run-script, s, se,
2017-09-26T20:06:09.160757+00:00 app[web.1]:     search, set, shrinkwrap, star, stars, start, stop, t, team,
2017-09-26T20:06:09.160757+00:00 app[web.1]:     test, tst, un, uninstall, unpublish, unstar, up, update, v,
2017-09-26T20:06:09.160758+00:00 app[web.1]:     version, view, whoami
2017-09-26T20:06:09.160760+00:00 app[web.1]: npm help   search for help on 
2017-09-26T20:06:09.160758+00:00 app[web.1]: 
2017-09-26T20:06:09.160761+00:00 app[web.1]: npm help npm     involved overview
2017-09-26T20:06:09.160759+00:00 app[web.1]: npm  -h     quick help on 
2017-09-26T20:06:09.160759+00:00 app[web.1]: npm -l           display full usage info
2017-09-26T20:06:09.160761+00:00 app[web.1]: 
2017-09-26T20:06:09.160763+00:00 app[web.1]: or on the command line via: npm  --key value
2017-09-26T20:06:09.160762+00:00 app[web.1]: Specify configs in the ini-formatted file:
2017-09-26T20:06:09.160764+00:00 app[web.1]: 
2017-09-26T20:06:09.160762+00:00 app[web.1]:     /app/.npmrc
2017-09-26T20:06:09.160763+00:00 app[web.1]: Config info can be viewed via: npm help config
2017-09-26T20:06:09.160765+00:00 app[web.1]: npm@5.3.0 /nodejs/lib/node_modules/npm
2017-09-26T20:06:26.707851+00:00 heroku[web.1]: Starting process with command `run start`
2017-09-26T20:06:29.650430+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-26T20:06:29.644361+00:00 heroku[web.1]: Process exited with status 1
2017-09-26T20:06:29.569145+00:00 app[web.1]: 
2017-09-26T20:06:29.569164+00:00 app[web.1]: Usage: npm 
2017-09-26T20:06:29.569165+00:00 app[web.1]: 
2017-09-26T20:06:29.569165+00:00 app[web.1]: where  is one of:
2017-09-26T20:06:29.569166+00:00 app[web.1]:     access, adduser, bin, bugs, c, cache, completion, config,
2017-09-26T20:06:29.569167+00:00 app[web.1]:     ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
2017-09-26T20:06:29.569168+00:00 app[web.1]:     explore, get, help, help-search, i, init, install,
2017-09-26T20:06:29.569168+00:00 app[web.1]:     install-test, it, link, list, ln, login, logout, ls,
2017-09-26T20:06:29.569169+00:00 app[web.1]:     outdated, owner, pack, ping, prefix, prune, publish, rb,
2017-09-26T20:06:29.569170+00:00 app[web.1]:     rebuild, repo, restart, root, run, run-script, s, se,
2017-09-26T20:06:29.569170+00:00 app[web.1]:     search, set, shrinkwrap, star, stars, start, stop, t, team,
2017-09-26T20:06:29.569171+00:00 app[web.1]:     test, tst, un, uninstall, unpublish, unstar, up, update, v,
2017-09-26T20:06:29.569171+00:00 app[web.1]:     version, view, whoami
2017-09-26T20:06:29.569172+00:00 app[web.1]: 
2017-09-26T20:06:29.569173+00:00 app[web.1]: npm  -h     quick help on 
2017-09-26T20:06:29.569174+00:00 app[web.1]: npm -l           display full usage info
2017-09-26T20:06:29.569174+00:00 app[web.1]: npm help   search for help on 
2017-09-26T20:06:29.569175+00:00 app[web.1]: npm help npm     involved overview
2017-09-26T20:06:29.569175+00:00 app[web.1]: 
2017-09-26T20:06:29.569176+00:00 app[web.1]: Specify configs in the ini-formatted file:
2017-09-26T20:06:29.569177+00:00 app[web.1]:     /app/.npmrc
2017-09-26T20:06:29.569177+00:00 app[web.1]: or on the command line via: npm  --key value
2017-09-26T20:06:29.569178+00:00 app[web.1]: Config info can be viewed via: npm help config
2017-09-26T20:06:29.569178+00:00 app[web.1]: 
2017-09-26T20:06:29.569179+00:00 app[web.1]: npm@5.3.0 /nodejs/lib/node_modules/npm

this is all a bit new to me but i'll ask around to see if anyone has ideas and follow up if they do

@chops318
Copy link

@hekod777
I've bypassed using Docker, but I successfully deployed this on heroku using heroku-buildpack-google-chrome.

It will probably help even if using Docker, but I think you need to add that buildpack and re-deploy

@do7be
Copy link

do7be commented Jan 17, 2018

I solved this using heroku-buildpack-google-chrome and #111 (comment)

@necipsunmaz
Copy link

**I could not publish the project on Heroku.

Here my build log:**

-----> Node.js app detected
-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_VERBOSE=false
   NODE_ENV=production
   NODE_MODULES_CACHE=true

-----> Installing binaries
engines.node (package.json): >=7
engines.npm (package.json): unspecified (use default)

   Resolving node version >=7...
   Downloading and installing node 10.7.0...
   Using default npm version: 6.1.0

-----> Restoring cache
Skipping cache restore (not-found)
-----> Building dependencies
Installing node modules (package.json + package-lock)

   > grpc@1.6.6 install /tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc
   > node-pre-gyp install --fallback-to-build --library=static_library
   
   node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v64-linux-x64.tar.gz
   node-pre-gyp ERR! Pre-built binaries not found for grpc@1.6.6 and node@10.7.0 (node-v64 ABI) (falling back to source compile with node-gyp)
   node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v64-linux-x64.tar.gz
   node-pre-gyp ERR! Pre-built binaries not found for grpc@1.6.6 and node@10.7.0 (node-v64 ABI) (falling back to source compile with node-gyp)
   make: Entering directory '/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/build'
   CC(target) Release/obj.target/grpc/src/core/lib/surface/init.o
   make: Entering directory '/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/build'
   CC(target) Release/obj.target/grpc/src/core/lib/surface/init.o
   rm: cannot remove './Release/.deps/Release/obj.target/grpc/src/core/lib/surface/init.o.d.raw': No such file or directory
   grpc.target.mk:394: recipe for target 'Release/obj.target/grpc/src/core/lib/surface/init.o' failed
   make: *** [Release/obj.target/grpc/src/core/lib/surface/init.o] Error 1
   make: Leaving directory '/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/build'
   CC(target) Release/obj.target/grpc/src/core/lib/channel/channel_args.o
   gyp ERR! build error
   gyp ERR! stack Error: `make` failed with exit code: 2
   gyp ERR! stack     at ChildProcess.onExit (/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
   gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
   gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
   gyp ERR! System Linux 4.4.0-1019-aws
   gyp ERR! command "/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/bin/node" "/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64"
   gyp ERR! cwd /tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc
   gyp ERR! node -v v10.7.0
   gyp ERR! node-gyp -v v3.6.2
   gyp ERR! not ok
   node-pre-gyp ERR! build error
   node-pre-gyp ERR! stack Error: Failed to execute '/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/bin/node /tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64/grpc_node.node --module_name=grpc_node --module_path=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64' (1)
   node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
   node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
   node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
   node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
   node-pre-gyp ERR! System Linux 4.4.0-1019-aws
   node-pre-gyp ERR! command "/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/bin/node" "/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
   node-pre-gyp ERR! cwd /tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc
   node-pre-gyp ERR! node -v v10.7.0
   node-pre-gyp ERR! node-pre-gyp -v v0.6.38
   node-pre-gyp ERR! not ok
   Failed to execute '/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/bin/node /tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64/grpc_node.node --module_name=grpc_node --module_path=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64' (1)
   CC(target) Release/obj.target/grpc/src/core/lib/channel/channel_stack.o
   CC(target) Release/obj.target/grpc/src/core/lib/channel/channel_stack_builder.o
   In file included from .././src/core/lib/channel/channel_stack_builder.h:24:0,
   from ../src/core/lib/channel/channel_stack_builder.c:19:
   .././src/core/lib/channel/channel_args.h:22:30: fatal error: grpc/compression.h: No such file or directory
   compilation terminated.
   grpc.target.mk:394: recipe for target 'Release/obj.target/grpc/src/core/lib/channel/channel_stack_builder.o' failed
   make: *** [Release/obj.target/grpc/src/core/lib/channel/channel_stack_builder.o] Error 1
   make: Leaving directory '/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/build'
   gyp ERR! build error
   gyp ERR! stack Error: `make` failed with exit code: 2
   gyp ERR! stack     at ChildProcess.onExit (/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
   gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
   gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
   gyp ERR! System Linux 4.4.0-1019-aws
   gyp ERR! command "/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/bin/node" "/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64"
   gyp ERR! cwd /tmp/build_b7fbcc8a1fa38eaa19518e6fb24bba2a/node_modules/grpc
   gyp ERR! node -v v10.7.0
   gyp ERR! node-gyp -v v3.6.2
   gyp ERR! not ok
   npm ERR! code ELIFECYCLE
   npm ERR! errno 1
   npm ERR! grpc@1.6.6 install: `node-pre-gyp install --fallback-to-build --library=static_library`
   npm ERR! Exit status 1
   npm ERR!
   npm ERR! Failed at the grpc@1.6.6 install script.
   npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
   
   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/npmcache.76qbu/_logs/2018-07-23T19_53_48_484Z-debug.log

-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys
   
   Some possible problems:
   
   - Dangerous semver range (>) in engines.node
   https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
   
   Love,
   Heroku

! Push rejected, failed to compile Node.js app.
! Push failed

@mavame
Copy link

mavame commented Feb 18, 2019

For what it's worth, I got up and running on Heroku using the previously mentioned buildpack. But I needed to do a few extra things so I want to document them here:

This assumes you've started a Heroku app and are interacting with it via the Heroku CLI.

First, add the Google Chrome buildpack to your project:

$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-google-chrome.git -a <app-name>

Next, add the heroku/nodejs buildpack to your project:

$ heroku buildpacks:add heroku/nodejs -a <app-name>

Then, update the package.json entry for engines to specific node and npm versions. I used:

{
  ...
  "engines": {
    "node": "10.15.1",
    "npm": "6.4.1"
  },
  ...
}

This was helpful in getting past a node-gyp issue during npm install, which Heroku will run each time you deploy.

Next, enter a new script into your package.json:

{
  "scripts": {
    ...,
    "heroku-postbuild": "npm run build"
  }
}

This will make sure to build rendertron into bin/rendertron on each deploy, in case you have any local changes.

Finally, add a Procfile to your project with the following:

web: node bin/rendertron

This worked for me and now I have a rendertron app running a node web server for free on Heroku.

@AVGP
Copy link
Collaborator

AVGP commented Sep 9, 2019

I guess the lack of activity and the success stories around the buildpack mean that this is sorted?

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

No branches or pull requests

8 participants