2

我没有更改任何内容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)

任何帮助表示赞赏。

4

1 回答 1

4

终于找到问题了。它与dart-sass使用而不是node-sasslaravel-mixv4.xx一起使用有关

结果发现与包含“#”符号的路径相关dart-sasslaravel-mix不适用于路径。在您的情况下,您的应用程序位于C:\Users\TAQI VAHEED\Desktop\#Coding\resPro并且该#Coding文件夹正在创建错误。

将您的应用程序移至路径中没有“#”符号的其他位置,或者按照laravel-mix 4.0.0 发行说明node-sass中的​​步骤再次启用:

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

npm install node-sass

 

mix.sass('resources/sass/app.sass', 'public/css', {
     implementation: require('node-sass')
});
于 2019-01-05T17:08:02.677 回答