I made a package.json
and added:
Heroku buildpacks:set heroku/python
It still fails when deploying. This is a python app so I don't know what is happening.
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
parse error: Invalid numeric literal at line 1, column 7
! Unable to parse package.json
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
For apps that do not have a buildpack explicitly set, Heroku tries to detect which buildpack to use in the following order:
Buildpack detection is based on the presence of certain files. In the case of the Node.js buildpack, it looks for a package.json
in the root directory of the project. It looks like your app has such a file.
Your question isn't entirely clear, but I think you put this text inside your package.json
:
Heroku buildpacks:set heroku/python
That is not valid, so the Node.js buildpack doesn't know what to do with it.
A package.json
file is from the Node.js ecosystem, and it must have a specific set of keys and values. Unless your application also requires Node.js, you shouldn't have a package.json
file at all. Assuming you don't need that file, delete it and commit its removal.
Your Python project will need one of the following:
requirements.txt
setup.py
Pipfile
and Pipfile.lock
If you already have one of these, great. Just redeploy and Heroku should detect your app as a Python app.
If you don't have any of these, the easiest thing to do is to place an empty requirements.txt
file in the root of your project. Make sure to commit it before deploying again.
If you wish to be explicit, you can run the command you tried to use before on the command line:
heroku buildpacks:set heroku/python
This shouldn't be necessary for a single-language app, though. Note that heroku
is all lowercase.