After diligently following all the steps outlined in this tutorial:
https://codeburst.io/quick-n-clean-way-to-deploy-vue-webpack-apps-on-heroku-b522d3904bc8
I encountered an error message when checking my app at:
The error indicated:
Method Not Allowed
Despite following the tutorial to push only the 'dist' folder to Heroku, I faced difficulties with deployment.
Various methods were attempted over a few days, which unfortunately led to confusion and left me seeking assistance for deploying the app successfully on Heroku.
The development and production environments functioned smoothly, but hurdles emerged specifically while deploying on Heroku.
You can find the link to my repository here:
Prior attempts involved deploying the entire root directory with the usage of this 'server.js' file:
// server.js
const express = require('express')
const path = require('path')
const history = require('connect-history-api-fallback')
const app = express()
const staticFileMiddleware = express.static(path.join(__dirname + '/dist'))
app.use(staticFileMiddleware)
app.use(history({
disableDotRule: true,
verbose: true
}))
app.use(staticFileMiddleware)
app.get('/', function (req, res) {
res.render(path.join(__dirname + '/dist/index.html'))
})
var server = app.listen(process.env.PORT || 8080, function () {
var port = server.address().port
console.log('App now running on port', port)
})
Upon executing 'git push heroku master,' logs revealed:
[Logs Content]
Alternatively, trying 'git subtree push --prefix dist heroku master' resulted in:
No new revisions found
Including 'Procfile' details:
web: node server.js
Further updates involved using 'heroku open' command, triggering:
Cannot GET /
Performing 'heroku logs --tail' displayed:
[Logs Content]
To address build issues, modifications were made in 'package.json':
[package.json content]
Despite these adjustments, the Heroku deployment process remained stuck in a continuous loop. Any attempts to halt it through the Heroku CLI proved ineffective, necessitating the recreation of the app each time.
An amended 'Procfile' configuration:
[Updated Procfile content]
Still could not resolve the building issues encountered during deployment.