简体   繁体   中英

How should I resolve an ERROR occuring while compiling Assets (Laravel Mix)

I am not new with PHP , but I am a total beginner with PHP frameworks. Recently I have started learning Laravel framework for PHP , so I decided to start with tutorials from Traversy Media channel. After I have tried to compile assets I got an ERROR: ( An error occurs after npm run dev )

ERROR in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/lib/loader.js??ref--5-5!./resources/sass/app.scss
Module build failed: BrowserslistError: Unknown browser query `basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")`
    at C:\xampp\htdocs\myapp\node_modules\browserslist\index.js:164:11
    at Array.reduce (<anonymous>)
    at resolve (C:\xampp\htdocs\myapp\node_modules\browserslist\index.js:132:18)
    at browserslist (C:\xampp\htdocs\myapp\node_modules\browserslist\index.js:224:16)
    at Browsers.parse (C:\xampp\htdocs\myapp\node_modules\autoprefixer\lib\browsers.js:61:16)
    at new Browsers (C:\xampp\htdocs\myapp\node_modules\autoprefixer\lib\browsers.js:52:30)
    at loadPrefixes (C:\xampp\htdocs\myapp\node_modules\autoprefixer\lib\autoprefixer.js:70:24)
    at plugin (C:\xampp\htdocs\myapp\node_modules\autoprefixer\lib\autoprefixer.js:81:24)
    at LazyResult.run (C:\xampp\htdocs\myapp\node_modules\postcss\lib\lazy-result.js:277:20)
    at LazyResult.asyncTick (C:\xampp\htdocs\myapp\node_modules\postcss\lib\lazy-result.js:192:32)
    at processing.Promise.then._this2.processed (C:\xampp\htdocs\myapp\node_modules\postcss\lib\lazy-result.js:231:20)
    at new Promise (<anonymous>)
    at LazyResult.async (C:\xampp\htdocs\myapp\node_modules\postcss\lib\lazy-result.js:228:27)
    at LazyResult.then (C:\xampp\htdocs\myapp\node_modules\postcss\lib\lazy-result.js:134:21)
    at Promise.resolve.then.then (C:\xampp\htdocs\myapp\node_modules\postcss-loader\lib\index.js:145:8)
    at <anonymous>
 @ ./resources/sass/app.scss 4:14-254
 @ multi ./resources/js/app.js ./resources/sass/app.scss

I am trying to solve this problem but without success. I have tried to rebuild node-sass, also I've tried to reinstall all dependencies and change my @import path and nothing solved an error.
This is the code that refers to an error that occurs in **C:\xampp\myapp\node_modules\browserslist\index.js:164:11**

Resolve function for referring error

If you could help me with this i would really appreciate it, because I really need to speed up my learning process.

npm -v 6.1.0
node -v 8.11.3
composer -v 1.7.2
artisan --version (Laravel Framework) 5.7.13

if npm install generate to much file in your root project
go to C:\\user{yourname} and empty .npmrc file (your will find prefix= something)

Second i resolve this issue by deleting node_modules and

"browserslist": [
        "last 3 versions"
    ],

in my package.json.

You run again npm install and npm run watch or dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM