【问题标题】:Error: File to import not found or unreadable Gulp + Sass错误:找不到要导入的文件或无法读取 Gulp + Sass
【发布时间】:2018-01-20 13:40:08
【问题描述】:

我正在尝试编译 Sass 并使用 BrowserSync 刷新浏览器。看起来对 styles.scss 文件进行了正确的更改,问题出在导入的文件上。当我进行一些更改时,我得到一个错误:

events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: dev\scss\styles.scss
Error: File to import not found or unreadable: base.
       Parent style sheet: C:/xampp/htdocs/test-gulp/dev/scss/styles.scss
        on line 1 of dev/scss/styles.scss
>> @import 'base';
   ^

    at options.error (C:\xampp\htdocs\test-gulp\node_modules\node-sass\lib\index.js:291:26)

这有时会在我第一次更新 _base.scss 文件时发生,但有时会在第三次或第四次更新后发生。

我用我的设置在 Github 上做了一个仓库,希望你能帮助我:https://github.com/kenramirez12/gulp-sass-browsersync

【问题讨论】:

    标签: gulp gulp-sass


    【解决方案1】:

    我认为问题出在您的编辑器上,更准确地说是原子保存行为。我不知道您使用什么文本编辑器,但我在 sublime 中编码时遇到了同样的错误,解决方案是在 sublime 设置中添加:"atomic_save": true。它帮助了我。

    【讨论】:

    • 我使用 VS Code,我尝试过使用 Sublime 将这一行添加到设置中,并且似乎工作正常(在添加此行之前有同样的问题),atm 我正在寻找任何类似的 VS Code
    • 尝试使用 gulp-wait 描述 here
    • 大声笑,是的 gulp-wait 终于是“解决方案”了,太棒了!
    猜你喜欢
    • 1970-01-01
    • 2015-09-15
    • 2015-08-03
    • 2019-08-08
    • 1970-01-01
    • 2014-09-19
    • 2018-05-05
    • 1970-01-01
    • 2017-10-04
    相关资源
    最近更新 更多