15

I received this message when i deploy to heroku:

remote: =====! create-react-app-buildpack has reached end-of-life 
remote:        This build may succeed, but the buildpack is no longer maintained.
remote:        On the Heroku-22 stack and beyond, this may fail to build at all.
remote:
remote:        Please consider migrating to https://nextjs.org or https://remix.run to develop React apps which are deployable using Heroku's Node.js buildpack https://github.com/heroku/heroku-buildpack-nodejs, or you may develop your own create-react-app deployment with Node.js and Nginx buildpacks.  

I'm using this buildpack:

https://github.com/mars/create-react-app-buildpack

But heroku will no longer support it. I don't know how to migrate my reactapp to nextjs or remix, anyone know an alternative buildpack that supports the newer version of heroku?

ReZ
  • 313
  • 1
  • 3
  • 13

3 Answers3

33

Old Answer

The buildpack you're using is deprecated and doesn't work on Heroku-22. The simple solution, which is what I've done, is to postpone upgrading the Heroku stack until a new buildpack for Create-React-App is released. Heroku-18 is deprecated though, so you should upgrade to Heroku-20.

heroku stack:set heroku-20

Updated answer (as of 2023-01-05)

If you have a static website without environment variables, you can use an express server to run the static pre-build assets. Instructions based on this Medium article.

  1. Remove the current buildpack from Heroku via the settings tab of your app in Heroku.
  2. Install express with npm install express (or yarn add express)
  3. Create a file scripts/heroku-start.js with the following content:
const express = require('express');
const path = require('path');
const app = express();
const port = process.env.PORT || 3000;
app.use(express.json());
// Your static pre-build assets folder
app.use(express.static(path.join(__dirname, '..', 'build')));
// Root Redirects to the pre-build assets
app.get('/', function(req,res){
  res.sendFile(path.join(__dirname, '..', 'build'));
});
// Any Page Redirects to the pre-build assets folder index.html that // will load the react app
app.get('*', function(req,res){
  res.sendFile(path.join(__dirname, '..', 'build/index.html'));
});
app.listen(port, ()=>{
  console.log("Server is running on port: ", port)
})
  1. Create a file Procfile with the following content:
web: node scripts/heroku-start.js
  1. Set Heroku stack to Heroku-22 and deploy.
  • 1
    I saw on the create-react-app-buildpack repo a suggestion to replace the create-react-app-buildpack with either NEXT or Remix. I'd appreciate the link if anyone finds any good guides on replacing your Heroku configuration with one of these. – Tori Sep 07 '22 at 15:54
  • to understand Heroku stack read this [Link](https://devcenter.heroku.com/articles/heroku-22-stack) – Micessien Sep 15 '22 at 01:36
  • can someone tell me where I'm supposed to create this "scripts" directory? thanks! – Jordan England-Nelson Apr 27 '23 at 17:54
  • @JordanEngland-Nelson Create the scripts directory in the root folder. – Andreas Winther Moen May 02 '23 at 09:40
2

I seem to have found a easy work around that is currently working on my site. I was getting the same error:

remote: =====> Detected Framework: Static HTML remote: Stack heroku-22 is not supported! remote: ! Push rejected, failed to compile React.js (create-react-app) multi app.

Although i already had the same page running on Heroku with different text/images (which is somehow running my react page without any buildpack currently).

To fix the issue this is what i tried and it allowed me to git push my app.

When you are pushing your react app from npm make sure to remove the react buildpack from the Heroku settings page for that app, repush via NPM and it should load without any issues and your app is now uploaded to Heroku. Now if you go and reapply your buildpack (https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz) and refresh your page it should be working fine.

Dwebb86
  • 69
  • 3
  • 1
    "Now if you go and reapply your buildpack (https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz) and refresh your page it should be working fine"—until the next time you deploy. Changing the buildpack after deploying doesn't do anything to your deployed application. It just changes the buildpacks that will be used in the future. – ChrisGPT was on strike Nov 28 '22 at 11:26
  • Thank you, it seems to have fixed my problem. – oyerohabib Feb 10 '23 at 20:09
0

FYI the new buildpack by the same commiter is now update and working..

https://github.com/heroku/heroku-buildpack-nodejs - Please review and plug this into the heroku :0

thank you internet NERDS - Love you all

Zero

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33860011) – Aaron Meese Feb 20 '23 at 23:40
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 22 '23 at 11:13