I have a web application written with a Python/Django backend API, and a Vue.js frontend.
We serve the static file produced by Vue as static Django files. The frontend application is located within a separate folder in the Django project.
At the moment before each deployment I need to run npm build locally and deploy with the dist folder.
I have a small script for deployment:
cd ./vuejs-frontend
npm install
npm run build
git add --force dist/*
git commit -m "Add dist folder"
local_branch=`git rev-parse --abbrev-ref HEAD`
git push heroku ${local_branch}:master -f
git reset --hard HEAD~1
cd ..
I want to move move the npm install part to be executed during the deployment. I am trying to add this in the release.sh that heroku executes during each deployment. Basically I want this in my release.sh:
cd ./vuejs-frontend
npm install
npm run build
cd ..
The problem is that the heroku/python buildpack does not have node and npm. I tried adding the heroku/nodejs along with the other buildbacks, but then Heroku complains during deployment, that it was not able to locate a node application:
remote: ! The 'heroku/nodejs' buildpack is set on this application, but was
remote: ! unable to detect a Node.js codebase.
Is there anyway to get npm on Heroku?