Skip to content
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

Couldn't find preset "es2015" relative to directory #519

Closed
lorenzosjb opened this issue Aug 30, 2016 · 6 comments
Closed

Couldn't find preset "es2015" relative to directory #519

lorenzosjb opened this issue Aug 30, 2016 · 6 comments

Comments

@lorenzosjb
Copy link

I am using Webstorm 2016.2.2.

I created the project and started it until the point of seeing the webpage up and running.
When I change something simple from src/App.js like the title text it show the error below.

It's missing dependencies on the project? I added babel-core, babel-loader, babel-preset-es2015, babel-preset-react to the dependencies and it worked

cmd.exe /D /C call C:/Users/jimenelo/Documents/NetBeansProjects/my-app/node_modules/.bin/babel.cmd --source-maps --out-file App-compiled.js --presets es2015 C:\Users\jimenelo\WebstormProjects\new-app\src\App.js
Error: Couldn't find preset "es2015" relative to directory "C:/Users/jimenelo/WebstormProjects/new-app/src"
at C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\options\option-manager.js:281:17
at Array.map (native)
at OptionManager.resolvePresets (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:20)
at OptionManager.mergePresets (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\options\option-manager.js:254:10)
at OptionManager.mergeOptions (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\options\option-manager.js:239:14)
at OptionManager.init (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\options\option-manager.js:338:12)
at File.initOptions (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\index.js:216:65)
at new File (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\file\index.js:137:24)
at Pipeline.transform (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transform (C:\Users\jimenelo\Documents\NetBeansProjects\my-app\node_modules\babel-cli\lib\babel\util.js:50:22)

Process finished with exit code 1

Adding the new dependencies created sort of problem:

cmd.exe /D /C call C:/Users/jimenelo/Documents/NetBeansProjects/my-app/node_modules/.bin/babel.cmd --source-maps --out-file App-compiled.js --presets es2015 C:\Users\jimenelo\WebstormProjects\new-app\src\App.js
SyntaxError: C:/Users/jimenelo/WebstormProjects/new-app/src/App.js: Unexpected token (8:6)
6 | render() {
7 | return (

8 |


| ^
9 |

10 | logo
11 |

Hello again From React

Process finished with exit code 1

@gaearon
Copy link
Contributor

gaearon commented Aug 30, 2016

What is this command? Did you type it by hand? Does some tool run it? This is definitely not how CRA projects should be used so I am very surprised to see it.

cmd.exe /D /C call C:/Users/jimenelo/Documents/NetBeansProjects/my-app/node_modules/.bin/babel.cmd --source-maps --out-file App-compiled.js --presets es2015 C:\Users\jimenelo\WebstormProjects\new-app\src\App.js

@gaearon
Copy link
Contributor

gaearon commented Aug 30, 2016

If you use something like Babel watcher described here, please disable it: https://blog.jetbrains.com/webstorm/2015/05/ecmascript-6-in-webstorm-transpiling/. It is not needed with Create React App and will not work correctly. Create React App setup takes care of transpilation so you don't need your IDE to call Babel.

@gaearon
Copy link
Contributor

gaearon commented Aug 30, 2016

cc @prigara

@prigara
Copy link
Contributor

prigara commented Aug 31, 2016

Hi @lorenzosjb!
@gaearon is right, with react-create-app you don't need to use a file watcher. All you need to do is to open a project created with react-create-app and then run npm start in the terminal or double-click on the start task in the npm tool window in WebStorm.
We're currently working on integration with react-create-app, we won't show this misleading suggestion to add a file watcher for these projects.

@gaearon
Copy link
Contributor

gaearon commented Aug 31, 2016

👍 Thanks for the update!

@lorenzosjb
Copy link
Author

Thanks to all, prigara and gaearon

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants