-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Using babel-preset-react-app
requires that you specify NODE_ENV
or BABEL_ENV
#2377
Comments
Manage to resolve it by adding it to the
And it works as expected, hope it could helps others! Note from maintainers: this is not a good fix because it will build your production projects in development mode. Don’t do it! Instead subscribe to this issue and provide more details about your system if you experience this. |
Hmm this doesn't sound right at all. You shouldn't need to set anything, and in fact setting them like this can create later issues. |
We are forcefully setting |
Can you try deleting |
same problem as @nicklayb - the |
I am also facing the same issue... It's in Windows though... |
I'm worried that if you just add this to your rc files you'll get development builds from production too. This is not the right solution and will give you builds many times bigger than they should be. Can you investigate why a variable set in that script "disappears" by the time that Babel preset executes? We really need more information here because I can't reproduce it. The suggested solution in this thread is dangerous and you should not do it but instead I encourage you to try to diagnose the issue. |
Everybody who has this problem, please could you share:
|
babel-preset-react-app
requires that you specify NODE_ENV
or BABEL_ENV
I understand... I am currently using this as only a temporary hack... Node Version : v7.9.0 |
Can you please remove the hack, verify it still fails on // ...
process.on('unhandledRejection', err => {
throw err;
});
process.env.NODE_ENV = 'development';
+process.env.BABEL_ENV = 'development'; at about line 20, and try |
Yay... That fixed it 😄 |
Can you post the exact message you were seeing before the fix? Did it also say "Instead received: undefined" or something else? |
/src/index.js |
That's great, thanks. |
Please try https://github.com/facebookincubator/create-react-app/releases/tag/v1.0.7 |
Adding "+process.env.BABEL_ENV = 'development';" worked for me too :) |
to fix this you need to do that :
i am using es2015 and stage-2 and for your : scripts : start.js add this :
you can create a development , test, build one. my advice to you and i found that it is good to understand what is happening is to eject the react project. |
What's the fix for a non-CRA app that uses Already tried adding to Update: My workaround was to simply switch to |
Can you reproduce the problem with latest npm?
yes
Can you still reproduce it?
yes
Description
When creating a new react app with
create-react-app
without doing anything, only runningyarn start
gives the following error :Expected behavior
Run the template React app
Actual behavior
Displays :
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected):node -v
:v6.2.1
npm -v
:4.6.1
Then, specify:
macOS Sierrra 10.12.5
Google Chrome Version 58.0.3029.110 (64-bit)
Reproducible Demo
Didn't add anything. Fresh install
The text was updated successfully, but these errors were encountered: