问题描述
在我项目的根目录下,我有一个frontend
和backend
文件夹.这两个文件夹都包含一个package.json
,其中列出了它们的依赖性.部署应用程序时,如何告诉Heroku在两个文件夹上均运行npm install
?看来Heroku希望默认情况下只有一个package.json
文件.我是否需要对Procfile做一些事情? Heroku文档似乎对我的具体问题并没有多说.
At the root of my project, I have a frontend
and backend
folder. Both folders contain a package.json
that list their dependencies. How do I tell Heroku to run npm install
on both folders when deploying the application? It seems like Heroku expects to have a single package.json
file by default. Do I have to do something with a Procfile? The Heroku documentation doesn't seem to tell much about my specific question.
感谢您的帮助!
推荐答案
您可以在程序文件:
web: cd front && npm i && npm start
server: cd backend && npm i && npm start
但是,您至少必须升级到Hobby.这是7美元/dyno/月.
However, you have to upgrade to Hobby at least. It's 7$/dyno/month.
这篇关于在相同的Heroku应用/dyno上部署后端和前端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!