Local or Private NPM module when deploying to Heroku

孤街浪徒 提交于 2019-12-13 18:10:05

问题


I have a node app that has a local npm module npm link ./local and I'm trying to deploy the app to heroku. Heroku runs npm install when I deploy, but npm link's aren't saved in package.json so my local module is missing.

I'm new to heroku and Procfiles, I'd like to run a script or just run npm link ./local before on the heroku box.

Alternatively I could put the module on github as a private repository and link it from there. But as far as I know Heroku isn't able to download private repo. Can I give Heroku access to my github repository via keys so that it could download it?

I'd love for somekind of solution! Anything!


回答1:


I think you need yo put modules in node_modules folder and push that to heroku

Procfiles are easy to maintain and heroku will read that

I have sample Procfile like

web: bin/hubot -a campfire

Even heroku also says that best is to include node_modules into repo so you can just include your local packages into that.

See more here Heroku Node Deploy



来源:https://stackoverflow.com/questions/19459805/local-or-private-npm-module-when-deploying-to-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!