Couldn't find preset "es2015" relative to directory
See original GitHub issueSorry to add to the flood of extra work, but having a weird issue adding Mix to a project
Just for clarity, this is the migration process that I followed
Updated package.json to contain
"scripts": {
"dev": "node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node_modules/cross-env/bin/cross-env.js NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"laravel-mix": "^0.5.3"
}
deleted the old node_modules folder, cleared npm cache, then ran npm install
Started to update the wepack file so far got to
const { mix } = require('laravel-mix');
mix
.js([
// Core dependencies
'theme-assets/frontend-core/vendor/jquery/2.1.4/jquery-2.1.4.min.js',
'theme-assets/frontend-core/vendor/modernizr/2.8.3/modernizr.min.js',
'theme-assets/frontend-core/vendor/underscorejs/1.8.3/underscore.min.js',
'theme-assets/frontend-core/vendor/owlcarousel/2.0.0.2.4/owl.carousel.min.js',
'theme-assets/frontend-core/vendor/selesti/cookielaw.js',
// UIKit
'theme-assets/frontend-core/vendor/uikit/2.23.0/js/uikit.js',
'theme-assets/frontend-core/vendor/uikit/2.23.0/js/components/sticky.js',
'theme-assets/frontend-core/vendor/uikit/2.23.0/js/components/slideshow.js',
// AngularJS
'theme-assets/frontend-core/vendor/angularjs/1.3.16/angular.min.js',
'theme-assets/frontend-core/vendor/selesti/selesti-app.js'
]), 'public/assets/js/vendor.js');
However when I run npm run dev
and webpack kicks in it comes up with
ERROR Failed to compile with 10 errors
error in ./theme-assets/frontend-core/vendor/selesti/selesti-app.js
Module build failed: Error: Couldn't find preset "es2015" relative to directory "/Users/owen"
at /Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/options/option-manager.js:292:19
at Array.map (native)
at OptionManager.resolvePresets (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/options/option-manager.js:274:20)
at OptionManager.mergePresets (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/options/option-manager.js:263:10)
at OptionManager.mergeOptions (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/options/option-manager.js:248:14)
at OptionManager.init (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
at File.initOptions (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/Users/owen/Sites/selesti/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/owen/Sites/selesti/node_modules/babel-loader/lib/index.js:38:20)
at /Users/owen/Sites/selesti/node_modules/babel-loader/lib/fs-cache.js:78:18
at ReadFileContext.callback (/Users/owen/Sites/selesti/node_modules/babel-loader/lib/fs-cache.js:14:14)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
I’ve checked my node_modules
folder and can see that the preset is included.
However for some odd reasons these are not playing ball.
Issue Analytics
- State:
- Created 7 years ago
- Comments:25 (3 by maintainers)
Top Results From Across the Web
Error: Couldn't find preset "es2015" relative to directory "/Users ...
To fix this issue You should remove .babelrc (hidden) file from "/Users/username" directory.
Read more >Couldn't find preset "es2015" relative to directory #93 - GitHub
I use gulp-babel in electron,I have all the dependencies installed. the code is : function compileJs(cb) { gulp.src(paths.src.js) ...
Read more >【Bug】Vue解决Couldn't find preset "es2015" relative to ...
Couldn't find preset “es2015” relative to directory原因由于引入的Element-UI 使用了ES标准,所以编译会报错。解决方法安装ES 标准npm install ...
Read more >Couldn't find preset "es2015" relative to directory-Reactjs
Coding example for the question Webpack + Babel: Couldn't find preset "es2015" relative to directory-Reactjs.
Read more >Module build failed: Error: Couldn't find preset "es2015" relative to ...
Module build failed: Error: Couldn't find preset "es2015" relative to directory.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was having the same problem.
node -v
)npm -v
)npm ls laravel-mix
)composer show laravel/framework
).babelrc
file were not in the root directory afternpm install
. I was having problems withasync
,await
, and other stuff. I have created the.babelrc
file and started getting “Couldn’t find preset “es2015” relative to directory” duringnpm run dev
.This StackOverflow answer suggest to check if
babel-preset-es2015
is installed. When I have executednpm ls babel-preset-es2015
, nothing was returned.npm install babel-preset-es2015 --save-dev
solved my problem.Noticed if you add your own
.babelrc
file withit solves the issue.