无法运行gulp任务

无法运行gulp任务,gulp,Gulp,我正在尝试运行一个简单的gulp sass任务,但出现以下错误: [22:42:14] Starting 'sass'... [22:42:14] Finished 'sass' after 10 ms events.js:72 throw er; // Unhandled 'error' event ^ Error: File not found with singular glob at Glob.<anonymous> (D:\Develo

我正在尝试运行一个简单的
gulp sass
任务,但出现以下错误:

[22:42:14] Starting 'sass'...
[22:42:14] Finished 'sass' after 10 ms

 events.js:72
    throw er; // Unhandled 'error' event
          ^
   Error: File not found with singular glob
at Glob.<anonymous> (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\index.js:34:30)
at Glob.EventEmitter.emit (events.js:95:17)
at Glob._finish (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\glob.js:171:8)
at done (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\glob.js:158:12)
at Glob._processSimple2 (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\glob.js:640:12)
at D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\glob.js:628:10
at Glob._stat2 (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\glob.js:724:12)
at lstatcb_ (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\glob.js:716:12)
at RES (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\node_modules\inflight\inflight.js:23:14)
at f (D:\Development\WebStorm\calliope\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob\node_modules\once\once.js:17:25)

错误不是很清楚,顺便说一下,
异常是由错误的链接引发的(未找到资源)

是的,这是正确的。只要找不到资源,就会抛出错误。我编写了一个函数来防止在我的文件中发生这种情况。 运行“npm安装fs--保存”。 然后将此添加到您的gulpfile中

var fs = require('fs');
var validateResources = function (resources) {
  resources.forEach(function (resource) {
    if (!fs.existsSync(resource)) {
      throw resource + " not found!";
    }
  });
};

有了这个,你在某种程度上是安全的。

这很奇怪,因为它几乎不可复制。你的文件夹结构怎么样?这些文件存在吗?是相对于Gulpfile的路径吗?我愚蠢的错误是,
.scss
的路径是错误的。吞咽是一个多么神秘的错误:这是一个路径错误?我得到了这个错误,我也怀疑它。@ConAntonakos是的,它发生在路径不正确的时候valid@steo-是的;我也证实了这一点。不过,这不是一条很好的错误消息:(
var fs = require('fs');
var validateResources = function (resources) {
  resources.forEach(function (resource) {
    if (!fs.existsSync(resource)) {
      throw resource + " not found!";
    }
  });
};