Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't find preset "es2015" relative to directory "web/static/js"

I'm trying to build a vagrant server for dabbling with elixir and phoenix, but after installing all requirements and dependencies, and on running mix phoenix.server I'm getting the following error:

error: Compiling of 'web/static/js/app.js' failed. Couldn't find preset "es2015" relative to directory "web/static/js" ;

I'm not sure of the context of 'preset' here, I'm hoping a more seasoned phoenix user will know what it's getting at.

Some cursory Google's gave me nothing, other than it might be something to do with babel.

Edit: I just tried installing what I assume to be the missing package, sudo npm install babel-preset-es2015 -g, but it hasn't resolved the error.

like image 448
Nathan Hornby Avatar asked Dec 17 '15 22:12

Nathan Hornby


3 Answers

Please see the fix here: https://github.com/phoenixframework/phoenix/issues/1410

  1. Upgrade to node >= v5.0.0
  2. npm cache clean
  3. cd my_app
  4. rm -rf node_modules/
  5. npm install
  6. mix phoenix.server
like image 195
Chris McCord Avatar answered Nov 01 '22 15:11

Chris McCord


I see that there is already an accepted answer here. I just encountered the exact same error, and tried the solution Chris posted above. It did not work for me, but based on the github issue link Chris posted above, I found a solution that worked for me.

I found that you don't necessarily need to be using node v5.0+. I am using node 4.4.3 LTS, and things are working.

npm install --save-dev babel-preset-es2015

like image 24
Sean McCleary Avatar answered Nov 01 '22 17:11

Sean McCleary


My solution which is great works:

.pipe(babel({
    presets: [require('babel-preset-es2015')]
}))

Thanks!

like image 2
user3577460 Avatar answered Nov 01 '22 17:11

user3577460