简体   繁体   中英

How do I setup a node_modules directory in a Heroku:Python application?

So my python web application needs to use a tool that is built on some node.js tools. Naturally I will place node_modules in my .gitignore and I intend on keeping it that way. Either way, I need to add another Heroku buildpack, easy.

=== staging-application Buildpack URLs
1. heroku/nodejs
2. heroku/python

I then do a git push staging master but Heroku responds with this

App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz

I've searched around for an answer regarding this but haven't gotten very far. Here are some files that may be of help in the investigation.

Here's my procfile

# Procfile
web: sh heroku.sh

Here's my heroku script

# heroku.sh
cd site

npm install postcss-cli
npm install autoprefixer

gunicorn run:app

As mentioned in " Herokuにデプロイされない! " (It is not deployed in Heroku!)

rootディレクトリが違った (The root directory is wrong)

In that article, Tatiana Yamaguchi mentions pushing the wrong folder as root directory, and said root folder shouls also include a Gemfile .

I found that the root directory is one folder above and that pushed objects do not have a Gemfile in the root directory. So Heroku did not understand that what was pushed was Ruby.
So I reworked the local repository again and changed it so that the position where Gemfile is located becomes root.

That is: like " Managing Gems with Bundler ", where it is recommended to:

Create a file named Gemfile in the root of your app specifying what gems are required to run it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM