6

i have an nodejs app deployed on heroku, i want to run some python scripts which depends on some packages like selenium on nodejs app deployed on heroku.

i have read about npm packages like 'node-python' and 'pyshell' and i have tested on localhost using 'node-python' to run the python scripts and i have installed all the require packages using pip, but i dont know how can i run these scripts on nodejs app which is deployed on heroku and how can i install all the required packages on which these scripts are dependent. Thank you.

1 Answers1

0

You need to create your package.json file. That's where your app configuration and dependencies are defined.

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

Nathan Loyer
  • 1,339
  • 10
  • 20
  • You could manually run a script after install, but before it spins up. See my answer to this thread: http://stackoverflow.com/a/42237745/673882 – Nathan Loyer Feb 14 '17 at 23:01
  • hi @Nathan Loyer, i read your answer in the link you mentioned above thanks alot for that . i just have one question if i write `ChildProcess.execSync('pip install selenium');` will the selenium package get installed? and where will it get installed i mean in which directory? also where can i find documentation for writing the 'heroku-build.js' script thanks alot. – nitin sachdev Feb 16 '17 at 14:49
  • hi @NathanLoyer i tried various ways to install python packages on heroku first i tried to use `ChildProcess.execSync('pip install selenium');` in 'heroku-build.js' but it didnt work after that i tried to install pip by running get-pip.py script but it showed a long error and failed to push..please help me – nitin sachdev Feb 16 '17 at 16:38
  • I'm not sure where python build packages should reside in a Heroku app. I wrote the `heroku-build.js` based on these guidelines: https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process – Nathan Loyer Feb 16 '17 at 17:33