Describe the bug
Hi. My created app is always stuck in development mode when deployed to Heroku in production and I cannot use .env.production.
Did you try recovering your dependencies?
The dependencies are built on Heroku.
Which terms did you search for in User Guide?
I've found some older posts on Google but none of the answers helped me.
Environment
current version of create-react-app: 5.0.0
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Binaries:
Node: 16.14.1 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.46)
Internet Explorer: 11.0.19041.1566
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
I created an app and made a few components. I also use axios to make API calls and I need different values for development and production.
I've also tried creating a brand-new app using the script. Same result.
- Create a new app via script
npx create-react-app my-app
- Add
You are running this application in <b>{process.env.NODE_ENV}</b> mode. somewhere in App.js
- Create a new Heroku app
- Deploy using Heroku Git
- Visit the deployed app in the browser.
Expected behavior
NODE_ENV should be in production mode. It's always in development mode despite the npm run build command being used.
Actual behavior
(Write what happened. Please add screenshots!)
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Describe the bug
Hi. My created app is always stuck in development mode when deployed to Heroku in production and I cannot use .env.production.
Did you try recovering your dependencies?
The dependencies are built on Heroku.
Which terms did you search for in User Guide?
I've found some older posts on Google but none of the answers helped me.
Environment
current version of create-react-app: 5.0.0
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Binaries:
Node: 16.14.1 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.46)
Internet Explorer: 11.0.19041.1566
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
I created an app and made a few components. I also use axios to make API calls and I need different values for development and production.
I've also tried creating a brand-new app using the script. Same result.
npx create-react-app my-appYou are running this application in <b>{process.env.NODE_ENV}</b> mode.somewhere in App.jsExpected behavior
NODE_ENV should be in production mode. It's always in development mode despite the npm run build command being used.
Actual behavior
(Write what happened. Please add screenshots!)
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)