本地或私有NPM模块部署到Heroku时

本地或私有NPM模块部署到Heroku时

本文介绍了本地或私有NPM模块部署到Heroku时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有本地npm模块 npm link ./local 的节点应用程序,我试图将该应用程序部署到heroku。 Heroku在部署时运行 npm install ,但 npm link 不保存在



我是新来的heroku和 Procfiles ,我想运行一个脚本或者在heroku框中运行 npm link ./local



或者,我可以将模块放在github上作为私有存储库,并从那里链接它。但据我所知,Heroku无法下载私人回购。我可以通过密钥将Heroku访问到我的github存储库,以便它可以下载它吗?

我喜欢某种解决方案!任何事情!

解决方案

我认为您需要将模块放入node_modules文件夹并将其推送至heroku



Procfiles很容易维护,而且heroku会读取它。



我有样例Procfile,比如

  web:bin / hubot -a篝火

还说最好的做法是将node_modules包含到repo中,这样您就可以将本地软件包包含进去。



在这里查看更多


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!

解决方案

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

这篇关于本地或私有NPM模块部署到Heroku时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:40