question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Babel fails if the js file destination is not on a child directory

See original GitHub issue
  • Laravel Mix Version: 0.12.1 (npm list --depth=0)
  • Node Version (node -v): 6.10.3
  • NPM Version (npm -v): 5.0.1
  • OS: OS X El Capitan 10.11.6

Description:

I 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.

Steps To Reproduce:

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');

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
acachacommented, Oct 4, 2017

@JeffreyWay still getting this error here

1reaction
nahtnamcommented, Jul 18, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module import returns error if not in same directory as ... - GitHub
I move the "Spinner" component to the same level. and it works fine!! ... Any idea why? The import path in the first...
Read more >
Not able to run simple babel from src folder to dist
This create new dist of dist like following but without the config.json file,why ? -dist -- bin ---www -- routes ---index1.js ---index2.js.
Read more >
Config Files - Babel.js
New in Babel 7.x, Babel has a concept of a "root" directory, which defaults to ... config files are separated from the physical...
Read more >
Error: Module not found on paths with a space in them - bud
Hi Bud version 6 has ModuleNotFound-Errors if a parent directory has a space in its name. It worked though in version 5.
Read more >
Configuration - Quokka.js
Please note that any Babel paths that you specify in your global config file will use your project folder as the root folder...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found