question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Laravel mix error in lines scss coments

See original GitHub issue
  • Laravel Mix Version: 6.0.25
  • Node Version 16.3.0
  • NPM Version 7.20.0
  • OS: Windows 11 Home

I’m trying use laravel-mix a no Laravel project.

Running the “npx mix” return a error in lines comments on .css files.

image

"dependencies": {
    "@popperjs/core": "2.9.2",
    "bootstrap": "5.0.2",
    "cross-env": "7.0.3",
    "laravel-mix": "6.0.25",
    "webpack": "5.45.1"
  },
  "devDependencies": {
    "resolve-url-loader": "^4.0.0",
    "sass": "^1.35.2",
    "sass-loader": "^12.1.0"
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
thecrypticacecommented, Jul 24, 2021

gah this is really aggravating that we have to do this but it makes sense. I’ll see if I can go through and update things tonight and get a release out soon

0reactions
ankurk91commented, Jul 24, 2021

This is happening due to npm v7.x, which auto installs peer dependency listed in vue-loader/package.json

  • Laravel mix requires css-loader v5
  • but vue-loader install css-loader v6 through peer-dependency

Larave mix should load webpack loaders like this -

 {
      loader: require.resolve('css-loader'),
      options: {
        modules: false,
        esModule: true,
        importLoaders: 2,
      }
    },

This will force node to resolve the css-loader child package (in this case v5) which was installed along with the parent package itself.

See how other packages is doing this https://github.com/symfony/webpack-encore/pull/739

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel-Mix | Double slash "//" comments in SCSS - Laracasts
I'm having a problem with Laravel-Mix on my Laravel-Vue SPA: when I try to run npm run prod, PostCSS produces an Unknown Word...
Read more >
Laravel mix skipping one scss line - Stack Overflow
I'm developing a Laravel project in Laravel 5.4. I use the Laravel mix package for css, mixing scss files. Today I added to...
Read more >
Laravel Mix - Laravel - The PHP Framework For Web Artisans
Laravel Mix, a package developed by Laracasts creator Jeffrey Way, provides a fluent API for defining webpack build steps for your Laravel application...
Read more >
Laravel Mix | Web Applications in PHP
If you use a CDN to link your CSS and JavaScript frameworks, you can remove (or comment out) the first two lines in...
Read more >
npm run dev is showing error on existing Laravel Project
Error [ERR_REQUIRE_ESM]: require() of ES Module [laravelApp]/node_modules/del/index.js from [laravelApp]/webpack.mix.js not supported.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found