Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp: Segmentation Fault 11 after Node 4.0 update

I just updated to Node 4.

When I run Gulp, I see:

Segmentation fault: 11

My includes:

var gulp = require('gulp');

var jscs = require('gulp-jscs');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var responsive = require('gulp-responsive');
var imagemin = require('gulp-imagemin');
var jpegtran = require('imagemin-jpegtran');
var rollup = require('gulp-rollup');
var webp = require('gulp-webp');
var spritesmith = require('gulp.spritesmith');

I am unable to get a debug task to run. Verbose doesn't spit out anything additional.

Thoughts?

like image 603
Union find Avatar asked Sep 09 '15 02:09

Union find


4 Answers

I also update to Node 4.0 and get a segmentation fault on my node server too. I just delete my node_modules directory and rerun npm install, and it is fine.

So I suspect it is because the new version of npm has trouble to load some modules installed by old npm --- but just for some modules, it is OK to directly run npm start after updating on my other servers. I haven't went deep into this.

As a quick fix I think you can try this on your own dependencies.

like image 165
Kevin Xi Avatar answered Nov 15 '22 02:11

Kevin Xi


The suggestion to delete node_modules and then run npm install is a good one. It will work. Slightly more efficient, though, might be to just run npm rebuild without deleting node_modules or running npm install. It will re-compile native modules for the new version of Node/V8 you have installed without having to download all the files again.

But if all else fails:

  • Remove your node_modules directory
  • npm cache clean && npm install
  • npm uninstall -g gulp && npm install -g gulp
like image 42
Trott Avatar answered Nov 15 '22 03:11

Trott


I ran into this issue recently, and attempted the steps shown above:

$ npm cache clean && npm install

But was still getting the fault. Even after deleting all files and running

$ npm install

So, did some more rooting, and found that there was an issue whereby some of the node modules had a files ending in .info, which caused Drupal (in which I'm running this framework) to attempt reading the .info files as the theme.info file. Renaming these files (with a different ending) fixed the issue.

Although my problem Drupal-specific, I could imagine similar issues cropping up on other frameworks, as well.

like image 3
karolus Avatar answered Nov 15 '22 01:11

karolus


My case the problem was that I had Node v5.9.0 installed. So I downgraded to v4.4.1-LTS and finally got it working again:

Using Homebrew:

$ brew tap homebrew/versions
$ brew install homebrew/versions/node4-lts

And then:

$ npm rebuild
like image 1
Jorge Epuñan Avatar answered Nov 15 '22 02:11

Jorge Epuñan