17

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?

Raptor
  • 53,206
  • 45
  • 230
  • 366
Union find
  • 7,759
  • 13
  • 60
  • 111
  • 2
    Remove your `node_modules` directory, then run `npm cache clean && npm install`. Lastly `npm uninstall -g gulp && npm install -g gulp`. – Trott Sep 09 '15 at 03:28

6 Answers6

19

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.

Kevin Xi
  • 328
  • 2
  • 9
11

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
Trott
  • 66,479
  • 23
  • 173
  • 212
  • The `npm rebuild` step didn't solve the problem for me. Your other suggestion is a duplicate of previous suggestions. – Union find Sep 11 '15 at 02:29
  • 1
    Upvoted you @Trott because, although it partially duplicated others, it was a very thorough answer with possible alternatives. +1 from me. – Tres Sep 12 '15 at 00:41
  • 5
    Aw, thanks. At the risk of sounding peevish, the whole having a problem with duplicating another answer is a little misguided anyway. The answer I'm supposedly duplicating happens to actually duplicate [the comment I had already made on the original post](http://stackoverflow.com/questions/32470067/gulp-segmentation-fault-11-after-node-4-0-update/32488684?noredirect=1#comment52802572_32470067). And that's totally fine, whether it was intentional or not. The point is to craft the most useful answer, not to be fastest or most original. – Trott Sep 12 '15 at 01:21
  • This worked for me! I was getting a segmentation fault [1] with laravel-elixir tried lots of other things but this worked. Thanks @Trott – thurzo101 Apr 26 '16 at 22:50
  • I only had to run npm cache clean and it fixed my issue – heart.cooks.mind Jul 20 '16 at 20:30
3

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.

karolus
  • 912
  • 7
  • 13
1

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
Jorge Epuñan
  • 710
  • 7
  • 9
1

I run across this bug today again. After about a hour of searching, reinstalling whole node.js, all plugins and gulp and cleaning cache of NPM, without solving it. I tried to go back few steppes in my SASS file.

And fixed it. But it was not by some mistake or variable in code but I made this statement to my file:

a
   transition: all 0.5s ease-in-out

   &:hover, &:focus
       transition: all 0.5s ease-in-out

Tried to make it again and again that bug occured. Really do not know why. When I use this statement nested in a class or another tag, it is working properly.

Ernedar
  • 172
  • 14
0

Please, delete your node_modules from project and do npm install

Sergey Andreev
  • 1,398
  • 3
  • 16
  • 26