问题
I am trying to deploy a Heroku app, and I believe the procfile may be the reason my app is not deploying. I've tried multiple solutions including:
web: node ./bin/www web: npm start
There may be another reason my app is not working, but I want to make sure my Procfile is set up correctly
回答1:
This is what I have:
- A file in the root directory of the project called
Procfile(no file extension) - Inside the file, the first line reads
web: bin/web - In the
bindirectory which is also located in the rood directory of the project, I have a file calledweband inside I havenode ./bin/www(well I have more, but lets keep it simple). - there is another file in the
bindirectory calledwwwwhere I have the code to start the node server. - Both files in the
bindirectory needs to be executable, and you can set this by doingchmod +x file_name
Explanation for the Procfile
As mentioned above, in the Procfile I have this line: web: bin/web where
web:- is the name of the process, and needs to bewebfor Heroku to like you :)bin/web- is the path to your file
I hope this helps :)
回答2:
You should do:
web: ./bin/www npm start
This is what fixed it for me!
来源:https://stackoverflow.com/questions/35663469/how-to-write-procfile-for-node-js-heroku-deployment-using-bin-www