Laravel Mix Runtime Solution for es2015 Error Reporting

01-28-2024

Overview of the system environment

2015 MacBook Pro 13.3 PHP 7.2.2 Laravel 5.7.9 Node v8.0.0 Npm 6.0.0

Recently, when using Laravel Mix, I executed the command npm run dev Times.

Couldn't find preset "es2015" relative to directory

solution

I searched Baidu for a circle and didn't find a suitable answer. Accidentally found the corresponding solution in the issues of Laravel Mix project on github, and the scheme is as follows:

Recommended: laravel tutorial

1. Add a. babelrc file in the root directory, with the following contents:

{ "presets": [ ["es2015", { "modules": false }] ] }

2. Execute the command:

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

Related recommendations, PHP video tutorial learning address: https://www.php.cn/course/list/29/type/2.html

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us