Laravel-mix: v 0.8.7 - mix.sass().options() - Module build failed: Error "...scss" is not in the SourceMap

Created on 24 Feb 2017  路  17Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.8.7
  • Node Version: 6.9.5
  • NPM Version: 4.2.0
  • OS: Windows 7

Description:

Updated to mix version 0.8.7 and getting the following error on
mix.sass('resources/assets/sass/app.scss', 'public/css').options({ processCssUrls: false }).version();

error in ./resources/assets/sass/app.scss

Module build failed: Error: "../../resources/assets/sass/_fonts.scss" is not in the SourceMap.
at SourceMapConsumer_sourceContentFor [as sourceContentFor] (C:...\node_modules\source-map\lib\source-map-consumer.js:704:13)
at SourceMapGenerator. (C:...\node_modules\source-map\lib\source-map-generator.js:235:40)
at Array.forEach (native)
at SourceMapGenerator_applySourceMap [as applySourceMap] (C:\VM-homestead\Code\laravel\node_modules\source-map\lib\source-map-generator.js:234:32)
at MapGenerator.applyPrevMaps (C:...\node_modules\postcss\lib\map-generator.js:146:22)
at MapGenerator.generateMap (C:...\node_modules\postcss\lib\map-generator.js:194:46)
at MapGenerator.generate (C:...\node_modules\postcss\lib\map-generator.js:297:25)
at LazyResult.stringify (C:...\node_modules\postcss\lib\lazy-result.js:294:24)
at C:...\node_modules\postcss\lib\lazy-result.js:231:27

@ ./resources/assets/sass/app.scss 4:14-183
@ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

error in ./resources/assets/sass/app.scss

When removing the options part everything works as expected. Tested on a fresh laravel project and getting the same error with mix..options({ processCssUrls: false })`

Most helpful comment

Same, when I set to
mix.options({ processCssUrls: false });

Then the error appear.

But after I add below to package.json it SOLVED.

"resolve-url-loader": "^2.0.0", "sass-loader": "^6.0.0",

All 17 comments

I just installed Laravel from scratch, added mix.options({ processCssUrls: false }) to my webpack.mix.js file, and it all compiled properly.

Can you try to reproduce your issue in a fresh app?

Tried that.

Fresh laravel install, run npm install and added mix.options({ processCssUrls: false }); to webpack.mix.js.

Same error:

> @ production C:\...\laravel
> node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 95% emitting

 ERROR  Failed to compile with 3 errors


 error  in ./resources/assets/sass/app.scss

Module build failed: Error: "../../resources/assets/sass/_variables.scss" is not in the SourceMap.
    at SourceMapConsumer_sourceContentFor [as sourceContentFor] (C:\...\laravel\node_modules\source-map\lib\source-map-consumer.js:704:13)
    at SourceMapGenerator.<anonymous> (C:\...\laravel\node_modules\source-map\lib\source-map-generator.js:235:40)
    at Array.forEach (native)
    at SourceMapGenerator_applySourceMap [as applySourceMap] (C:\...\laravel\node_modules\source-map\lib\source-map-generator.js:234:32)
    at MapGenerator.applyPrevMaps (C:\...\laravel\node_modules\postcss\lib\map-generator.js:146:22)
    at MapGenerator.generateMap (C:\...\laravel\node_modules\postcss\lib\map-generator.js:194:46)
    at MapGenerator.generate (C:\...\laravel\node_modules\postcss\lib\map-generator.js:297:25)
    at LazyResult.stringify (C:\...\laravel\node_modules\postcss\lib\lazy-result.js:294:24)
    at C:\...\laravel\node_modules\postcss\lib\lazy-result.js:231:27

 @ ./resources/assets/sass/app.scss 4:14-183
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

 error  in ./resources/assets/sass/app.scss

Module build failed: ModuleBuildError: Module build failed: Error: "../../resources/assets/sass/_variables.scss" is not in the SourceMap.
    at SourceMapConsumer_sourceContentFor [as sourceContentFor] (C:\...\laravel\node_modules\source-map\lib\source-map-consumer.js:704:13)
    at SourceMapGenerator.<anonymous> (C:\...\laravel\node_modules\source-map\lib\source-map-generator.js:235:40)
    at Array.forEach (native)
    at SourceMapGenerator_applySourceMap [as applySourceMap] (C:\...\laravel\node_modules\source-map\lib\source-map-generator.js:234:32)
    at MapGenerator.applyPrevMaps (C:\...\laravel\node_modules\postcss\lib\map-generator.js:146:22)
    at MapGenerator.generateMap (C:\...\laravel\node_modules\postcss\lib\map-generator.js:194:46)
    at MapGenerator.generate (C:\...\laravel\node_modules\postcss\lib\map-generator.js:297:25)
    at LazyResult.stringify (C:\...\laravel\node_modules\postcss\lib\lazy-result.js:294:24)
    at C:\...\laravel\node_modules\postcss\lib\lazy-result.js:231:27
    at C:\...\laravel\node_modules\webpack\lib\NormalModule.js:141:35
    at C:\...\laravel\node_modules\loader-runner\lib\LoaderRunner.js:364:11
    at C:\...\laravel\node_modules\loader-runner\lib\LoaderRunner.js:230:18
    at context.callback (C:\...\laravel\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\...\laravel\node_modules\postcss-loader\index.js:153:13

 error

C:\...\laravel\node_modules\extract-text-webpack-plugin\loader.js??ref--8-0!C:\...\laravel\node_modules\style-loader\index.js!C:\...\laravel\node_modules\raw-loader\index.js!C:\...\laravel\node_modules\postcss-loader\index.js!C:\...\laravel\node_modules\sass-loader\lib\loader.js??ref--8-4!C:\...\laravel\resources\assets\sass\app.scss doesn't export content

            Asset      Size  Chunks                    Chunk Names
       /js/app.js    286 kB       0  [emitted]  [big]  /js/app
mix-manifest.json  32 bytes          [emitted]

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\...\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "production"
npm ERR! node v6.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ production: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ production script 'node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\...\AppData\Roaming\npm-cache\_logs\2017-02-24T15_52_53_389Z-debug.log

After that, i changed the laravel-mix version to 0.8.1 in package.json and i am getting no errors on npm run production or npm run dev.

Probably windows related...

Hi Jeffrey,

I got the same error with a fresh installation on WIndows system with mix.options({ processCssUrls: false })
Module build failed: Error: "../../resources/assets/sass/_variables.scss" is not in the SourceMap.

laravel-mix@^0.8.2:
version "0.8.7"

having the exact problem as well on Windows, when trying to import another scss files

Me too..I've same problem after add option url false..

Looks like we needed to bump sass-loader and resolve-url-loader dependencies to fix this. I've pushed and tagged it.

2cb8714a7a765346d6967c7c803bb92440c4fbdf

bumped. Seems not working when we follow the steps in Laravel site.

Placing the options as a third argument doesn't work either. The processCssUrls seem not to work either.

I'm getting the exact same issues

mix.js('js/app.js', 'js/compiled.js') .sass('sass/app.scss', 'css/compiled.css') .options({ processCssUrls: false })
` ERROR Failed to compile with 1 errors 1:50:30 PM

error in ./sass/app.scss

Module parse failed: /Users/noah/Code/le-grav-test/user/themes/limited-edition/sass/app.scss Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
| @import "includes/reset";
| @import "includes/mixins";
| @import "includes/variables";
`

i dont know why, it am getting this issue back, i checked mix packages.json file, i found that, resolve resolve-url-loader & sass-loader still not bump to 2.0.0 and 6.0.0

I get this same error again, it worked yesterday but after a fresh npm install today it does not work anymore

Tested it with a fresh installation of Laravel, also returns this error.

node -v v7.7.1
npm -v 4.1.2

Create fresh Laravel installation
composer create-project --prefer-dist laravel/laravel mix-test

Install node modules
npm install

Run
npm run dev

No errors

Disable processCssUrls
mix.options({ processCssUrls: false });
Returns error:

 ERROR  Failed to compile with 3 errors                                                                                                                                                                                              11:56:19 AM

 error  in ./resources/assets/sass/app.scss

Module build failed: Error: "../../resources/assets/sass/_variables.scss" is not in the SourceMap.
    at BasicSourceMapConsumer.SourceMapConsumer_sourceContentFor [as sourceContentFor] (C:\Projects\mix-test\node_modules\source-map\lib\source-map-consumer.js:704:13)
    at SourceMapGenerator.<anonymous> (C:\Projects\mix-test\node_modules\source-map\lib\source-map-generator.js:235:40)
    at Array.forEach (native)
    at SourceMapGenerator_applySourceMap [as applySourceMap] (C:\Projects\mix-test\node_modules\source-map\lib\source-map-generator.js:234:32)
    at MapGenerator.applyPrevMaps (C:\Projects\mix-test\node_modules\postcss\lib\map-generator.js:146:22)
    at MapGenerator.generateMap (C:\Projects\mix-test\node_modules\postcss\lib\map-generator.js:194:46)
    at MapGenerator.generate (C:\Projects\mix-test\node_modules\postcss\lib\map-generator.js:297:25)
    at LazyResult.stringify (C:\Projects\mix-test\node_modules\postcss\lib\lazy-result.js:294:24)
    at C:\Projects\mix-test\node_modules\postcss\lib\lazy-result.js:231:27

 @ ./resources/assets/sass/app.scss 4:14-183
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

 error  in ./resources/assets/sass/app.scss

Module build failed: ModuleBuildError: Module build failed: Error: "../../resources/assets/sass/_variables.scss" is not in the SourceMap.
    at BasicSourceMapConsumer.SourceMapConsumer_sourceContentFor [as sourceContentFor] (C:\Projects\mix-test\node_modules\source-map\lib\source-map-consumer.js:704:13)
    at SourceMapGenerator.<anonymous> (C:\Projects\mix-test\node_modules\source-map\lib\source-map-generator.js:235:40)
    at Array.forEach (native)
    at SourceMapGenerator_applySourceMap [as applySourceMap] (C:\Projects\mix-test\node_modules\source-map\lib\source-map-generator.js:234:32)
    at MapGenerator.applyPrevMaps (C:\Projects\mix-test\node_modules\postcss\lib\map-generator.js:146:22)
    at MapGenerator.generateMap (C:\Projects\mix-test\node_modules\postcss\lib\map-generator.js:194:46)
    at MapGenerator.generate (C:\Projects\mix-test\node_modules\postcss\lib\map-generator.js:297:25)
    at LazyResult.stringify (C:\Projects\mix-test\node_modules\postcss\lib\lazy-result.js:294:24)
    at C:\Projects\mix-test\node_modules\postcss\lib\lazy-result.js:231:27
    at runLoaders (C:\Projects\mix-test\node_modules\webpack\lib\NormalModule.js:176:19)
    at C:\Projects\mix-test\node_modules\loader-runner\lib\LoaderRunner.js:364:11
    at C:\Projects\mix-test\node_modules\loader-runner\lib\LoaderRunner.js:230:18
    at context.callback (C:\Projects\mix-test\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\Projects\mix-test\node_modules\postcss-loader\index.js:148:13

 error

C:\Projects\mix-test\node_modules\extract-text-webpack-plugin\loader.js??ref--8-0!C:\Projects\mix-test\node_modules\style-loader\index.js!C:\Projects\mix-test\node_modules\raw-loader\index.js!C:\Projects\mix-test\node_modules\postcss-loader\index.js!C:\Projects\mix-test\node_modules\sass-loader\lib\loader.js??ref--8-4!C:\Projects\mix-test\resources\assets\sass\app.scss doesn't export content
                                                                                                                                                                                                                                               Asset      Size  Chunks                    Chunk Names
       /js/app.js   1.18 MB       0  [emitted]  [big]  /js/app
mix-manifest.json  32 bytes          [emitted]

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v7.7.1
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Projects\mix-test\npm-debug.log

Same, when I set to
mix.options({ processCssUrls: false });

Then the error appear.

But after I add below to package.json it SOLVED.

"resolve-url-loader": "^2.0.0", "sass-loader": "^6.0.0",

@coder77 Thank youuu!!! It worked!

@coder77 save my day! Thanks!

@coder77 Thanks!

Thank you @coder77

@coder77 where exactly did you past "resolve-url-loader": "^2.0.0", "sass-loader": "^6.0.0", on package json

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cheddam picture Cheddam  路  3Comments

mementoneli picture mementoneli  路  3Comments

nezaboravi picture nezaboravi  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

rderimay picture rderimay  路  3Comments