npm list --depth=0)node -v): 6.10.3npm -v): 5.0.1I have a project where the asset management is handled on a
Babel fails if the js file destination is not on a child directory, and triggers the Module build failed: Error: Couldn't find preset "env" relative to directory ... error.
File structure:
/assets
webpack.mix.js
webpack.mix.js
package.json
js/
app.js
sass/
app.sass
/application
/frontend
/js
/css
Mix code
mix.js('js/app.js', './../application/frontend/js/app.js'); // fails
// If the dest is a child directory, there is no problem
mix.js('js/app.js', 'foo/foo.js');
I'm having the same error :(
Try replacing mix.js() with mix.scripts() and see if it works.
Fixed in 1.0+.
Still having this issue on version 1.2.2.
I have the following:
mix.js('./js/app.js', './js/app.js');
and inside I do:
import "phoenix_html"
and as a result I get the following error:
Module build failed: Error: Couldn't find preset "env" relative to directory "../deps/phoenix_html/priv/static"
(I have edited the path in the error to be relative instead of static).
EDIT: @ruchern .scripts doesnt work. It removes the error from the terminal and puts it in the web console.
I'm having this issue as well. We have a shared js library outside of our laravel project that doesn't get imported and throws the Couldn't find preset "env" relative to directory error when compiling. This actually works fine in versions before 1.
@JeffreyWay still getting this error here