Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jest (JS) segmentation fault 11 in IO.js 1.4.3 when using require()

I'm using IO.js 1.4.3 and Jest to run my test suites. I need a newer version of V8 because I am using ES6 features like Promises.

If I try the simplest possible test:

describe('the truth', function() {
    it('is true', function() {
        expect(true).toBeTruthy();
    });
});

it works (thankfully). If I include, however, a call to require() (which I have to do to test my own code), I get:

Using Jest CLI v0.4.0
Waiting on 1 test...Segmentation fault: 11

This happens irrespective of which module I include, and whether I make a call to jest.dontMock() first.

This doesn't really tell me very much qua error message, and require really does seem to be the problem. Are there any solutions to this other than reverting to pre-1.0 node.js?

like image 467
GTF Avatar asked Nov 01 '22 08:11

GTF


1 Answers

This happens in cases where you have installed node_modules using node at some version, and then later switching to iojs using nvm install iojs and trying to run the installed node_modules with npm. It isn't likely that this is your issue, but hopefully anyone else googling around can try this and fix it.

nvm install iojs
rm -rf node_modules
npm install

then running whatever it is you're trying to run, usually something like npm run start.

like image 99
Liam Horne Avatar answered Nov 08 '22 04:11

Liam Horne