SASS停止编译:导入的文件未找到或不可读:util / util

时间:2016-11-19 15:02:53

标签: laravel-5 sass gulp zurb-foundation gulp-sass

我刚刚与Zurb Foundation(sass)开始了一个Laravel 5.3项目。我配置了gulpfile.js来编译我的sass和它曾经正常工作直到今天停止编译。 几天前工作。 我没有触摸代码或升级之间的任何东西......

错误:

MBP-Nicolas:v1 nicolas$ gulp
[15:50:09] Using gulpfile ~/Documents/Developpement/PHP/Laravel/Project/v1/gulpfile.js
[15:50:09] Starting 'default'...
[15:50:09] Starting 'sass'...

Fetching Sass Source Files...
   - resources/assets/sass/app.scss


Saving To...
   - public/css/app.css

[15:50:11] Finished 'default' after 1.31 s
[15:50:11] gulp-notify: [Laravel Elixir] Sass Compilation Failed: resources/assets/sass/_settings.scss
Error: File to import not found or unreadable: util/util
       Parent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss
        on line 43 of resources/assets/sass/_settings.scss
>> @import 'util/util';
   ^

{ [Error: resources/assets/sass/_settings.scss
Error: File to import not found or unreadable: util/util
       Parent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss
        on line 43 of resources/assets/sass/_settings.scss
>> @import 'util/util';
   ^
]
  status: 1,
  file: '/Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss',
  line: 43,
  column: 1,
  message: 'resources/assets/sass/_settings.scss\nError: File to import not found or unreadable: util/util\n       Parent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss\n        on line 43 of resources/assets/sass/_settings.scss\n>> @import \'util/util\';\n   ^\n',
  formatted: 'Error: File to import not found or unreadable: util/util\n       Parent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss\n        on line 43 of resources/assets/sass/_settings.scss\n>> @import \'util/util\';\n   ^\n',
  messageFormatted: '\u001b[4mresources/assets/sass/_settings.scss\u001b[24m\nError: File to import not found or unreadable: util/util\n       Parent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss\n        on line 43 of resources/assets/sass/_settings.scss\n>> @import \'util/util\';\n   ^\n',
  messageOriginal: 'File to import not found or unreadable: util/util\nParent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss',
  relativePath: 'resources/assets/sass/_settings.scss',
  name: 'Error',
  stack: 'Error: resources/assets/sass/_settings.scss\nError: File to import not found or unreadable: util/util\n       Parent style sheet: /Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/resources/assets/sass/_settings.scss\n        on line 43 of resources/assets/sass/_settings.scss\n>> @import \'util/util\';\n   ^\n\n    at options.error (/Users/nicolas/Documents/Developpement/PHP/Laravel/Project/v1/node_modules/node-sass/lib/index.js:292:26)',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-sass' }
[15:50:11] Finished 'sass' after 1.38 s
[15:50:11] Starting 'copy'...

Fetching Copy Source Files...
   - node_modules/font-awesome/fonts/**/*


Saving To...
   - public/fonts

[15:50:11] Finished 'copy' after 55 ms
[15:50:11] Starting 'styles'...

Fetching Styles Source Files...
   - node_modules/font-awesome/css/font-awesome.min.css
   - public/css/app.css


Saving To...
   - public/css/all.css

[15:50:11] gulp-notify: [Laravel Elixir] Stylesheets Merged!
[15:50:11] Finished 'styles' after 95 ms
[15:50:11] Starting 'scripts'...

Fetching Scripts Source Files...
   - node_modules/jquery/dist/jquery.js
   - node_modules/foundation-sites/dist/foundation.min.js
   - resources/assets/js/main.js


Saving To...
   - public/js/all.js

[15:50:12] gulp-notify: [Laravel Elixir] Scripts Merged!
[15:50:12] Finished 'scripts' after 1.3 s

我真的不知道你还需要什么,但这是我的gulpfile:

var elixir = require('laravel-elixir');

elixir(function(mix) {

    //Compilation SASS
    mix.sass('app.scss', null, null, { includePaths: ['node_modules/foundation-sites/scss'] });

    //Copy of fonts
    mix.copy('node_modules/font-awesome/fonts', 'public/fonts');

    //Compilation CSS
    mix.styles([
        '../../../node_modules/font-awesome/css/font-awesome.min.css',
        '../../../public/css/app.css'
    ]);

    //Compilation JavaScript
    var JSJquery = '../../../node_modules/jquery/dist/jquery.js';
    var JSFoundation = '../../../node_modules/foundation-sites/dist/foundation.min.js';

    mix.scripts([
        JSJquery,
        /*JSFoundation + 'foundation.core.js',
         JSFoundation + 'foundation.util.keyboard.js',
         JSFoundation + 'foundation.util.box.js',
         JSFoundation + 'foundation.util.triggers.js',
         JSFoundation + 'foundation.util.mediaQuery.js',
         JSFoundation + 'foundation.util.motion.js',
         JSFoundation + 'foundation.reveal.js',
         JSFoundation + 'foundation.offcanvas.js',*/
        JSFoundation,
        'main.js'
    ]);

});

_settings.scss的第43行是@import 'util/util';。 如果它有用,则可以使用某些版本的工具:

  1. node -v:v4.6.0
  2. npm -v:2.15.9
  3. sass -v:Sass 3.4.15(选择性 史蒂夫)
  4. 但就像我说的那样,我不记得升级任何一个。

    感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

根据你的gulp文件和sass文件,你应该在你的位置找到你的util.scss文件&node -modules / foundation-sites / scss / util / util.scss'这是因为您的gulp文件中包含以下内容

mix.sass('app.scss', null, null, { includePaths: ['node_modules/foundation-sites/scss'] });

以及设置文件中的以下内容

util/util

确保文件位于该位置,否则,相应地修改gulpfile或设置文件。

编辑:你能发布你的' sass'来自你的gulpfile的任务,这可能会有所帮助吗?