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

Solution to es2015 error when running Laravel Mix

藏色散人
Release: 2020-03-12 08:47:26
forward
2750 people have browsed it

Overview

System environment

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

Recently when using Laravel Mix, an error occurred when executing the command npm run dev

Couldn't find preset "es2015" relative to directory
Copy after login

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 }]
  ]
}
Copy after login

2. Execution command:

sudo npm install babel-preset-es2015 --save-dev
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template