Home  >  Article  >  PHP Framework  >  Solution to es2015 error when running Laravel Mix

Solution to es2015 error when running Laravel Mix

藏色散人
藏色散人forward
2020-03-12 08:47:262650browse

Overview

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, an error occurred when executing the command npm run dev

Couldn't find preset "es2015" relative to directory

Solution Solution

I searched on Baidu but couldn’t find a suitable answer. I accidentally found the corresponding answer in the issues in the Laravel Mix project on github. The solution is as follows:

Recommended: laravel tutorial

1. Add the .babelrc file to the root directory , File content:

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

2. Execution 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

The above is the detailed content of Solution to es2015 error when running Laravel Mix. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete