我开始像往常一样编码,做简单的 scss(没什么花哨的,向 div 添加动画)
segmentation fault (core dumped) gulp
我删除了我的 node_modules,进行了 npm-install,没有任何变化。
我见过很多人成功地做到了这一点,但我做不到。
出于某种原因,它在这里寻找一个 libsass 弯曲:
node_modules/gulp-sass/node_modules/node-sass/vendor/linux-x64-14/binding.node
但我的文件夹结构不同:
node_modules/gulp-sass/node_modules/node-sass/vendor/linux-x64-47/binding.node
我在 Kubuntu 15.04 更新到 15.10 时使用 gulp,一切都很顺利。
这是我的 gulp 文件:
var gulp = require('gulp'),
sass = require('gulp-sass'),
minifyCss = require('gulp-minify-css'),
gulpConcat = require('gulp-concat'),
rename = require('gulp-rename'),
sourcemaps = require('gulp-sourcemaps'),
livereload = require('gulp-livereload'),
uglify = require('gulp-uglify');
gulp.task('sass', function () {
gulp.src('./scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
// .pipe(minifyCss())
.pipe(sourcemaps.write('/'))
.pipe(gulp.dest(''))
.pipe(livereload());
});
gulp.task('compress', function() {
return gulp.src(['javascripts/application.js'])
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(uglify())
.pipe(gulpConcat('application.min.js'))
.pipe(gulp.dest(''))
.pipe(livereload());
});
gulp.task('sass:watch', function () {
gulp.watch('scss/**/*.scss', ['sass']);
gulp.watch('javascripts/**/*.js', ['compress']);
});
gulp.task('default', ['sass:watch', 'compress'], function() {
livereload.listen();
});
这是完整的错误:
/home/XX/workspace/XX/assets/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:158
throw new Error([
^
Error: The `libsass` binding was not found in /home/XX/workspace/XX/assets/node_modules/gulp-sass/node_modules/node-sass/vendor/linux-x64-14/binding.node
This usually happens because your node version has changed.
Run `npm rebuild node-sass` to build the binding for your current node version.
at Object.sass.getBinaryPath (/home/XX/workspace/XX/assets/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:158:11)
at Object.<anonymous> (/home/XX/workspace/XX/assets/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:16:36)
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)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/XX/workspace/XX/assets/node_modules/gulp-sass/index.js:176:21)
at Module._compile (module.js:460:26)