gulp watch在Laravel5中使用sass失败了

时间:2015-02-12 09:29:01

标签: laravel laravel-5 laravel-elixir

我使用的是Laravel 5,我想使用sass。 我将gulpfile.js从less更改为sass。

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

/*
 |--------------------------------------------------------------------------
 | 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 Less
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {
  mix.sass('app.scss')
     .coffee();
});

然而,当我运行gulp watch时,它失败了。

[take@take]% gulp watch 
[18:24:45] Using gulpfile ~/Sites/myapp/gulpfile.js
[18:24:45] Starting 'watch'...
[18:24:45] Starting 'sass'...
[18:24:45] 'sass' errored after 10 ms
[18:24:45] Error: Module did not self-register.
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/take/Sites/myapp/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:211:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
Error running task sequence: { task: 'sass',
  message: 'sass catch',
  duration: 0.010338111,
  hrDuration: [ 0, 10338111 ],
  err: [Error: Module did not self-register.] }
[18:24:45] Finished 'watch' after 17 ms

node -vv0.12.0

2 个答案:

答案 0 :(得分:0)

我的节点版本问题。 https://github.com/dlmanning/gulp-sass/issues/152

我降级到节点v0.10.36,然后gulp watch运行良好。

答案 1 :(得分:0)

我做了

sudo npm update

它对我有用。