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

Long time Rails User; First Time Elixir User - Static Assets Issue with preset2015 #1574

Closed
fuzzygroup opened this issue Mar 3, 2016 · 4 comments

Comments

@fuzzygroup
Copy link

Hi,

I'm trying to experiment with Elixir and I keep getting problems with asset pipeline. Specifically:

02 Mar 20:40:07 - error: Compiling of web/static/js/app.js failed. Couldn't find preset "es2015" relative to directory "/Users/sjohnson/elixir/phoenix" ; Compiling of web/static/js/socket.js failed. Couldn't find preset "es2015" relative to directory "/Users/sjohnson/elixir/phoenix"

Brand new install of elixir, erlang, node, npm, brunch OSX 10.10.2

Environment

  • Elixir version (elixir -v):
    Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.2.3

  • Phoenix version (mix deps):
  • fs 0.9.1 (Hex package) (rebar)
    locked at 0.9.2 (fs)
    ok
  • gettext 0.10.0 (Hex package) (mix)
    locked at 0.10.0 (gettext)
    ok
  • ranch 1.2.1 (Hex package) (rebar)
    locked at 1.2.1 (ranch)
    ok
  • poison 2.1.0 (Hex package) (mix)
    locked at 2.1.0 (poison)
    ok
  • phoenix_pubsub 0.0.1 (https://github.com/phoenixframework/phoenix_pubsub.git) (mix)
    locked at 137481d
    ok
  • cowlib 1.0.2 (Hex package) (rebar)
    locked at 1.0.2 (cowlib)
    ok
  • cowboy 1.0.4 (Hex package) (rebar)
    locked at 1.0.4 (cowboy)
    ok
  • plug 1.1.2 (Hex package) (mix)
    locked at 1.1.2 (plug)
    ok
  • phoenix_html 2.5.0 (Hex package) (mix)
    locked at 2.5.0 (phoenix_html)
    ok
  • phoenix 1.2.0-dev (https://github.com/phoenixframework/phoenix.git) (mix)
    locked at f1d77c1
    ok
  • phoenix_live_reload 1.0.3 (Hex package) (mix)
    locked at 1.0.3 (phoenix_live_reload)
    ok
  • NodeJS version (node -v):
    v5.7.0
  • NPM version (npm -v):
    3.8.0
  • Operating system:
    OSX 10.10.2

I looked thru the closed issue here: #1545 and followed all the steps but no luck.

Any suggestions? Thanks in advance.

@wojtekmach
Copy link
Contributor

@fuzzygroup you might find some help in #1410

@fuzzygroup
Copy link
Author

There was a lot of very interesting information in #1410 but the real fix (at least for me) was:

  1. In your applications root directory create a .babelrc file
  2. In that file put this one line::
    { "presets": ["es2015"] }

That does fix everything. None of the other suggestions - re-installing node, deleting node_modules, npm clean cache, updating brunch-config.js, etc made any difference. Apparently the .babelrc file is present in the master branch of phoenix not but copied into generated apps. I might suggest that making this automatic (copying it into generated apps) would be a good idea given how long it took to sort this out (most of an evening).

Thanks!

@dokuboyejo
Copy link

Alternative, rather than creating a .babelrc file, you can do the following

  1. add babel-preset-es2015 as a requirement in your package.json
  2. update your brunch-config.json like so
    plugins: { babel: { presets: ['es2015'], ... } }
  3. run npm install
  4. mix phoenix.server and you should be good to go

@curist
Copy link

curist commented Aug 1, 2017

For me, it turns out to be that I have a .babelrc in my home folder, so brunch or babel will trace all the way up to my home folder, and make it as the project root.

Create a .babelrc in assets/ folder works, I end up deleting my ~/.babelrc eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants