Gulp错误:路径必须是字符串

时间:2016-10-14 11:27:05

标签: laravel gulp zurb-foundation

我遇到了gulp.js的问题。

重现的步骤:

$ composer global require "laravel/installer=~1.1"
$ laravel new myproject
$ cd myproject
$ php artisan serve 
$ npm install
$ npm rm bootstrap-sass —save
$ npm install foundation-sites —save
$ npm install motion-ui —save

然后我复制

_settings.scss 

node_modules/foundation-sites/scss/settings 

resources/assets/sass
在app.scss中

然后我把每个基金会导入

最后我写了Elixir任务,如下所示:

http://zecipriano.com/en/2015/12/laravel-elixir-and-zurb-foundation-revisited/

但是当我从终端启动gulp时:

 path.js:7
  throw new TypeError('Path must be a string. Received ' + inspect(path));

......不知道该怎么做。

所有内容都已更新,所以我认为这不是版本问题。

[编辑]

$ node -v

v6.8.0

这是我的gulpfile.js:

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

require('laravel-elixir-vue-2');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {

    // Sass
    var options = {
        includePaths: [
            'node_modules/foundation-sites/scss',
            'node_modules/motion-ui/src'
        ]
    };

    mix.sass('app.scss', null, options);

    // Javascript
    var jQuery = '../../../node_modules/jquery/dist/jquery.js';
    var foundationJsFolder = '../../../node_modules/foundation-sites/js/';

    mix.scripts([
       jQuery,
       foundationJsFolder + 'foundation.core.js',
       // Include any needed components here. The following are just examples.
       foundationJsFolder + 'foundation.util.mediaquery.js',
       foundationJsFolder + 'foundation.util.keyboard.js',
       foundationJsFolder + 'foundation.util.timerAndImageLoader.js',
       foundationJsFolder + 'foundation.tabs.js',
       // This file initializes foundation
       'start_foundation.js'
    ]);

});

有什么想法吗?

提前谢谢。

2 个答案:

答案 0 :(得分:9)

问题是选项已从第三个参数移到第四个参数。您可以使用以下命令运行它:

   mix.sass('app.scss', null, null, options);

干杯:D

答案 1 :(得分:0)

我安装了节点4.4.2并且反击了同样的错误。然后我直接传递了目录字符串,而不是使用带方向的数组。