Laravel Mix中的“模块构建失败...”

时间:2018-12-29 15:06:02

标签: npm laravel-mix npm-run

我在app.scss中没有进行任何更改,但是运行npm run watch时出现以下错误:

    error  in ./resources/sass/app.scss                                                                      

Module build failed (from ./node_modules/sass-loader/lib/loader.js):                                      
Unsupported operation: Cannot extract a file path from a URI with a fragment component                    

@ ./resources/sass/app.scss 2:14-254                                                                     

    Asset      Size   Chunks             Chunk Names                                                     
/js/app.js  2.46 MiB  /js/app  [emitted]  /js/app                                                         

ERROR in ./resources/sass/app.scss                                                                        
Module build failed (from ./node_modules/css-loader/index.js):                                            
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):                    

undefined                                                                                                 
      ^                                                                                                  
      Join(null, "variables"): part 0 was null, but part 1 was not.                                       
@import 'variables';                                                                                      
        ^^^^^^^^^^^                                                                                       
  stdin 2:9  root stylesheet                                                                              
      in C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\resources\sass\app.scss (line 2, column 9)           
    at runLoaders (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\webpack\lib\NormalModule.js:30
    at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:364:11  
    at C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\LoaderRunner.js:230:18  
    at context.callback (C:\Users\TAQI VAHEED\Desktop\#Coding\resPro\node_modules\loader-runner\lib\Loader
13)

任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:1)

最后找到了问题。这与dart-sass v4.x.x使用node-sass而不是laravel-mix

结果表明与dart-sasslaravel-mix相关的某些内容不适用于包含'#'符号的路径。对于您而言,您的应用位于{{ 1}},而C:\Users\TAQI VAHEED\Desktop\#Coding\resPro文件夹正在创建错误。

将您的应用移动到路径中没有“#”符号的其他位置,或者按照laravel-mix 4.0.0 release notes中的步骤再次启用#Coding

  

您可以手动切换回node-sass,如下所示:

node-sass
     

npm install node-sass