Getting "Segmentation Error: 11" from NodeJS after Update 4.0

I just reinstalled NodeJS. Before reinstalling, when I ran node -v , I got a version number that said something like "0.2.x" ... It was a weird number. And since I read this morning, Node was just upgraded to version 4.xx. I thought I should update it. Also, I had other problems, so I thought that might be the reason for this.

When I start the following server.js, I get the following console listing.

server.js ...

 var express = require('express'); var mongoose = require('mongoose'); var bodyParser = require('body-parser'); var methodOverride = require('method-override'); var _ = require('lodash'); // Create the application. var app = express(); // Add Middleware necessary for REST API's app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.json()); app.use(methodOverride('X-HTTP-Method-Override')); // CORS Support app.use(function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); res.header('Access-Control-Allow-Headers', 'Content-Type'); next(); }); // Connect to MongoDB mongoose.connect('mongo connection string......'); mongoose.connection.once('open', function() { // Load the models. app.models = require('./models/index'); // Load the routes. var routes = require('./routes'); _.each(routes, function(controller, route) { app.use(route, controller(app, route)); }); console.log('Listening on port 3000...'); app.listen(3000); }); 

The console displays the following data after starting node --debug server.js

 Debugger listening on port 5858 Segmentation fault: 11 

Edit: I have another project based on MEANJS. When I run Gruntfile.js , I get a Segmentation fault: 11 from the console.

Edit # 2: I just dropped to Node v0.12.7 and everything looks fine ...

+5
source share
2 answers

I believe that you need to reinstall some native lib in node_modules , so basically you might need to remove node_modules and npm install again.

In addition, npm cache clean may be required before installation.

+9
source

Before uninstalling node_modules and then running npm install again, try npm rebuild . It will recompile its own modules for the new version of Node / V8 that you installed, without having to download all the files again.

npm rebuild should work. But if that is not the case, try removing node_modules and running npm install as a node_modules option.

0
source

All Articles