"Process out of memory" error after installing node from source - node.js

I'm trying to install NodeJS on shared hosting. I downloaded the source from
https://nodejs.org/en/download/
and followed the usual install procedure with ./config --prefix="$HOME/local".
It compiles without error. However, when I try to run it, I get the following error:
installing /kunden/homepages/32/d690510543/htdocs/local/include/node/zconf.h
installing /kunden/homepages/32/d690510543/htdocs/local/include/node/zlib.h
(uiserver):xxxxxxxx:~/node-v8.11.2$ which node
/kunden/homepages/32/d690510543/htdocs/local/bin/node
(uiserver):xxxxxxxx:~/node-v8.11.2$ node
#
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
#
Illegal instruction
However, I can get the version
$ node -v
v8.11.2
and help.
Nevertheless, I can't run a script
(uiserver):xxxxxxxx:~$ cat hello.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
(uiserver):xxxxxxxx:~$ node hello.js
#
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
#
Illegal instruction
Nor can I enter the REPL:
(uiserver):xxxxxxxx:~$ node -i
#
Fatal error in , line 0
API fatal error handler returned after process out of memory
#
Illegal instruction

I had the same issue and what i realized was that it was only occuring when i use mlab sandbox mongo db.Initially everything was ok even with mlab mongo db but all over sudden i the error started appearing .I changed to locally installed mongodb and all was well,i deleted my mlab mongo db collections and changed back to mlab,all was well again.I guess the issue is with mlab free tier limitations

When I execute my Vue.js project with command:
npm run dev
in webstorm console, the console output:
# Fatal error in , line 0
# API fatal error handler returned after process out of memory
Then when I restart use command:
npm run dev
webstorm crashes, I restart webstorm and use command:
npm run dev
a second time, and it works. So I think it is because that my computer memory is not enough when webstorm starts too many child processes.

Had the same issue (and afaik the same hosting provider). However, installing node through nvm, like described e.g. at https://stackoverflow.com/a/33857377/1680728 did solve the issue for me. I do not know whether its some environment setting or has to do with the fetched binaries/version.
So, I cannot solve the "Process out of memory" error, but I guess the real problem was to have any nodejs version running on a shared host.

I had the same issue and I close my webstorme and try again

Related

NodeJS app (Keystone JS) runs fine when started manually, restarts over and over when started with pm2

I am using Ubuntu 16.04 x 64 and I'm running into an issue -
When I run my Keystone JS app manually by typing in "node keystone", the app runs fine and I can view it in my browser like normal.
However, when I start the app using pm2, the app fails immediately and restarts consecutively.
I think it is because keystonejs has a known "error" that is not a real error, but just a warning when it starts.
From the "keystone-out-0.log" file -
Error ...node_modules/bson/build/Release/bson.node: invalid ELF header
However, in the "keystone-error-0.log" file, it gives me a different error that does not occur when I run it manually -
Error: ENOENT: no such file or directory, open '.env'
Any one faced anything similar?
Thanks

Need help getting simple node.js express to run

I'm trying a simple sample of node express that I copied from online. The script is below which I think is pretty standard.
var http = require('http');
http.createServer(function(request, response)){
response.writeHead(200);
response.write("hello");
response.end();
}).listen(8080);
console.log('listening on port 8080...');
I used the bash on ubuntu on windows command as follows:
npm init
node SampleServer.js (the name of my file)
When I do this, I expect some response from the command line. But when I enter the "node SamplerServer.js" command, nothing happens. When I direct the browser to port 8080, I get an error message as well.
I'm using nodeclipse and the installing that on my machine was pretty complicated. Prior to any of the steps above, I created an express project in eclipse ide. It seems to perform a lot of pre steps but in the end, I think I'm getting some of the error messages below. I'm mentioning this because I'm thinking perhaps I installed one of the modules wrong.
enter image description here
Start with simple stuff...
Use express-generator to create simple app by the following command
1-> npm install -g express-generator with root or Admin access
2-> Run express demoapp.
3-> Navigate to demoapp
4-> Do npm install
5-> Run from command with npm start: it run by default on http://localhost:3000
Hit that URL from Browser

Running node.js server with mongodb error

I'm still new to node.js and mongodb. Now I'm trying to solve this problem.
I have instructions to run my server without any problems, I follow them and yes my server works. But when I switched the server off then run it again I face this bug:
[vagrant#localhost ~]$ node /opt/inapsrv/app/app.js
app-api listening at http://0.0.0.0:7000
/opt/inapsrv/node_modules/fileupload/lib/modules/file.js:23
throw error
^
Error: ENOENT, mkdir 'data/imagex/'
And here is the line of the directory above taken from app.js file:
var imagePath = 'data/imagex/';
I tried to:
make vagrant and mongo users as super users and they have the root permissions.
to run "sudo node /opt/inapsrv/app/app.js"
run "forever /opt/inapsrv/app/app.js"
and it didn't work.
I don't know why it successfully ran the first time, and then it didn't!
Any help?
I suspect you're using node module fileupload for the upload job. The source code fragment in fileupload that throws your error can be found here.
The problem with the code used in fileupload module is that it does not create recursive directories since fs.mkdir is used. To fix your issue try to create the upload directory or at least data upfront. You could do this by a npm script, in app.js using the mkdirp or simply by a shell script.
The problem described is not related to mongodb or mongoose.

NodeJS: forever.js throws binding error : EROFS read only file system

Okay, so I am using nodejitsu's forever(v0.11.1) module to keep my NodeJS(v0.10.28) + expressJS(3.5.1) server running on VPS(CentOS-6.4). Everything was working smoothly untill recently when I started getting following error while running command: forever start server.js As soon as I run this command I got the following error:
I tried to see the file: ls - l /root/.forever/tVYM.log, No such file was found
When I tried to start my node server using pm2, I got the following error:
I don't understand why is this happening even if I am root(su) user. Also, if I try to edit my server.js file, CentOS won't let me edit file and warns me about insufficient privilege.
But when I rebooted VPS and used forever, things were okay again but after some time, my server went down again and when I used forever to run my node app, forever threw the same error. I just can not see reason behind this. Thanks in advance

PhantomJS exited unexpectedly with exit code -1073741819

I run a bunch of Jasmine specs with PhantomJS (via Grunt) on a Windows 7 PC, and I happen to get the following error:
Testing jasmine specs via phantom
......
Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.
Aborted due to warnings.
The error does not appear if I delete a bunch of tests; however I have no idea what causes the error.
What I also find strange, it that it only occurs now and then.
Any idea why this happens?
We are running AngularJS tests via jasmine and grunt, and had this very same problem. For us it turned out to be due to our custom $exceptionHandler function.
We were missing the throw exception line that is in the example handler. By not throwing the exception, the test would pass but it would randomly cause PhantomJS to crash.
This means that some of our tests were failing and we didn't know it!
Here's the sample handler from the $exceptionHandler documentation page:
angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
return function (exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception; // <--- This is important
};
});
So I'd look and see if you have custom exception handling too and are possibly missing the throw exception line.
I hope it's as simple as that for you too!
(Sadly, I don't have an answer. I would post as a comment, but I don't have the rep.)
I'm getting the same error trying to create html snapshots with grunt-html-snapshot.
Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.
Aborted due to warnings.
I'm feeding grunt a list of URLs and I "randomly" get this crash somewhere in the list. I think I have traced it to the child process spawn call that launches phantom.exe with the bridge.js script. It doesn't seem to get as far as trying load the next page before the phantom.exe child process exits with the error. I haven't been able to find any documentation on the error code.
I received the same error message as Helge after renaming a folder and running jasmine in grunt.
The folder contained all the JavaScript files I wanted to minify into one file, and I renamed the folder to match the final file name. For example the folder, \src\modules\ was renamed \src\modules.js\.
Removing .js from the folder name solved the problem.
Using PhantomJS to generate snapshots for AngularJS.
The snapshots script goes through an array of urls of which it has to take snapshots.
Narrowed down to the possible cause and as it turned out there was a bug in my latest fix in AngularJS. This bug resulted in the constantly switching the home page and the page where the error occurred.
Code Visualization:
$state.go('home state');
...
$state.go('an other state');
...
$state.go('home state');
...
$state.go('an other state');
...
$state.go('home state');
...
...
=> Error: PhantomJS exited unexpectedly with exit code -1073741819
In short:
For me this error was caused by an infinite redirect loop.
The warning PhantomJS exited unexpectedly with exit code -1073741819 is also displayed when your local PhantomJS is incompatible or corrupt.
With npm list -g phantomjs you can check your PhantomJS version.
If you think that it is corrupt, just reinstall it with:
npm uninstall phantomjs -g
npm install phantomjs -g

Resources