node

Error First Callbacks in Node JS

Callbacks are a systemic part of a Node.js application. A non-blocking well-balanced flow of controlled asynchronous modules is made possible by properly implemented callbacks. But what is “properly implemented”? Creating code that will scale with your projects means using a reliable protocol that is a well-known standard. The “error-first” callback (also known as an “error-back”,… Read more Error First Callbacks in Node JS

Iterate an array with a promise in javascript

Example of how to iterate an array with a promise It can be challenging to figure out how to iterate over an array of items with a promise. The following code takes a callback function that may or may not be a promise already. Once inside the PromiseForEach function, the callback will become a promise… Read more Iterate an array with a promise in javascript

[solved] devtool reloads if application writes to a file

If you are developing a node js application using devtool, you may experience a rather frustrating situation whereby you application stops without any traceable errors followed by a subsequent reload of the devtool. Why does devtool keep reloading when there are no errors? There is a likelyhood that you are experiencing this issue as you… Read more [solved] devtool reloads if application writes to a file

SOLVED: /usr/bin/env: node: No such file or directory

While working with NodeJS on an AWS Ubuntu 14 box, I got the following error:

On some Linux distributions, AWS in my case, there is a namespace issue which causes errors at times. The error is a result of some distributions installing NodeJS with the name nodejs as opposed to node. The fix is easy Simply create a… Read more SOLVED: /usr/bin/env: node: No such file or directory

Error: listen EADDRINUSE with NodeJS Server

EADDRINUSE indicates the port number that listen() is attempting to bind the server to is already in use. Sometimes, even though you have hit Control C a few times. Somehow nodejs is still running. My guess is that there are lingering processes from a faulty termination for whatever reason. How to fix Error: listen EADDRINUSE… Read more Error: listen EADDRINUSE with NodeJS Server

How to setup Node.js application server with port 80 

Port 80 Redirect port 80 to port 3000 with this command:

Then launch the Node.js application on port 3000. Now requests to port 80 will map to the nodejs application on port 3000. Edit the /etc/rc.local file and adding iptables port redirection line (without ‘sudo’). This step with cause the port redirect when the… Read more How to setup Node.js application server with port 80 

Error: listen EADDRINUSE

The npm web server is a very simple web server used in development and testing for delivering static files. While attempting to use start the npm web server you may see an error like this:

One fast way to resolve the issue is:

Or, you may try the following solution to the listen EADDRINUSE… Read more Error: listen EADDRINUSE

How To Fix: “Errno::ENOENT: No such file or directory @ rb_sysopen – undefined” Grunt Error

While setting up a grunt.js file, I ran into the following stubborn error.

After having Googled several solutions to the problem. I ended up updating my Ruby and uninstalling and re-installing nodejs among other things. It turns out I had a misspelling in the directory of the key-data pair inside the grunt.js file. I… Read more How To Fix: “Errno::ENOENT: No such file or directory @ rb_sysopen – undefined” Grunt Error