Questions tagged [node.js]

Node.js is an event-based, non-blocking, asynchronous I/O runtime that uses Google's V8 JavaScript engine and libuv library. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client as well as on the server side and therefore benefit from the re-usability of code and the lack of context switching.

Node.js is an event-based, non-blocking, asynchronous I/O (input/output) runtime that uses Google's V8 JavaScript Engine.

, commonly just called Node, is often used for developing applications that rely on the ability to run both on the client and server side. Running the same language on both the client and the server benefits from improved code reusability and less context switching.

A notable feature of is that it is non-blocking – if one task stalls or pauses for an I/O operation, another can take over while idle. This allows for high efficiency as the program as a whole never has to idle and wait for one task to finish. Libraries such as async take advantage of this capability. More information can be found here.

It's also possible to use mature JavaScript frameworks like YUI and jQuery for server-side DOM manipulation in .

To ease the development of complex JavaScript further, Node.js supports the CommonJS standard that allows for modularized development and the distribution of software in packages via the Node Package Manager (NPM).

Download node.js:

Applications that can be written using Node.js include, but are not limited to:

  • Static file servers
  • Web Application frameworks
  • Messaging middleware
  • Servers for HTML5 multi player games, or streaming audio/video
  • Real time applications
  • Cross-platform programs

When asking questions about Node.js, you should:

  1. Make sure to check the official API documentation before asking, your question might be trivial.
  2. Isolate the problem and reproduce it with as little code as possible.
  3. If the question has nothing to do with anything that's specific, please consider asking it as a question instead.
  4. Mention which version of Node.js you are running. When in doubt, use node -v or node --version.
  5. Make sure to only use the tag, since is ambiguous.

Interesting Questions and Answers

Useful Links

Tutorials, Guides and Books

Talks, Presentations, and Podcasts on Node.js

Free Node.js Books and Resources

Chat Room & Mailing list

Logging

  • pino - Extremely fast logger inspired by Bunyan.
  • winston - Multi-transport async logging library.
  • console-log-level - The most simple logger imaginable with support for - log levels and custom prefixes.
  • storyboard - End-to-end, hierarchical, real-time, colorful logs and stories.
  • signale - Hackable console logger with beautiful output.

Official logo

Official logo

Node.js is copyrighted by the openJS Foundation

466830 questions
742
votes
30 answers

How do I update Node.js?

I did the following to update my npm: npm update npm -g But I have no idea how to update Node.js. Any suggestions? (I'm using Node.js 0.4.1 and want to update to Node.js 0.6.1.)
alexchenco
  • 53,565
  • 76
  • 241
  • 413
740
votes
34 answers

MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

I can't make a simple connection to the server for some reason. I install the newest MySQL Community 8.0 database along with Node.JS with default settings. This is my node.js code var mysql = require('mysql'); var con =…
Pig
  • 7,505
  • 3
  • 10
  • 14
727
votes
27 answers

How can I wait In Node.js (JavaScript)? l need to pause for a period of time

I'm developing a console script for personal needs. I need to be able to pause for an extended amount of time, but, from my research, Node.js has no way to stop as required. It’s getting hard to read users’ information after a period of time... I’ve…
Christopher Allen
  • 7,769
  • 5
  • 20
  • 35
719
votes
25 answers

How to use executables from a package installed locally in node_modules?

How do I use a local version of a module in node.js. For example, in my app, I installed coffee-script: npm install coffee-script This installs it in ./node_modules and the coffee command is in ./node_modules/.bin/coffee. Is there a way to run this…
typeoneerror
  • 55,990
  • 32
  • 132
  • 223
713
votes
63 answers

Node Sass couldn't find a binding for your current environment

I am having issues building an app because node-sass keeps failing with the error. ERROR in Missing binding /Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node Node Sass could not find a binding for…
wazzaday
  • 9,474
  • 6
  • 39
  • 66
712
votes
30 answers

How to store Node.js deployment settings/configuration files?

I have been working on a few Node apps, and I've been looking for a good pattern of storing deployment-related settings. In the Django world (where I come from), the common practise would be to have a settings.py file containing the standard…
mikl
  • 23,749
  • 20
  • 68
  • 89
712
votes
9 answers

Node.js version on the command line? (not the REPL)

I want to get the version of Node.js on the command line. I'm expecting to run a command like: node -version but that doesn't work. Does anybody know what the command line would be? (i.e. not the REPL)
hawkeye
  • 34,745
  • 30
  • 150
  • 304
708
votes
7 answers

What is "require" in JavaScript and NodeJS?

I'm trying to get JavaScript to read/write to a PostgreSQL database. I found this project on GitHub. I was able to get the following sample code to run in Node. var pg = require('pg'); //native libpq bindings = `var pg = require('pg').native` var…
neuromancer
  • 53,769
  • 78
  • 166
  • 223
708
votes
42 answers

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

What might be causing the error Error: EACCES: permission denied, access '/usr/local/lib/node_modules'? npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission…
hendra dedi
  • 7,124
  • 3
  • 9
  • 10
705
votes
20 answers

Local dependency in package.json

I want to do something like this, so npm install also installs the package.json of ../somelocallib or more importantly its dependencies. "dependencies": { "express": "*", "../somelocallib": "*" }
user1680104
  • 8,437
  • 4
  • 22
  • 27
701
votes
7 answers

How can I specify the required Node.js version in package.json?

I have a Node.js project that requires Node version 12 or higher. Is there a way to specify this in the packages.json file, so that the installer will automatically check and inform the users if they need to upgrade?
Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183
699
votes
17 answers

Node.js on multi-core machines

Node.js looks interesting, BUT I must miss something - isn't Node.js tuned only to run on a single process and thread? Then how does it scale for multi-core CPUs and multi-CPU servers? After all, it is all great to make fast as possible…
zaharpopov
  • 16,882
  • 23
  • 75
  • 93
694
votes
9 answers

How, in general, does Node.js handle 10,000 concurrent requests?

I understand that Node.js uses a single-thread and an event loop to process requests only processing one at a time (which is non-blocking). But still, how does that work, lets say 10,000 concurrent requests. The event loop will process all the…
g_b
  • 11,728
  • 9
  • 43
  • 80
692
votes
36 answers

Node Version Manager install - nvm command not found

I am trying to install NVM as per these instructions I typed in this command in terminal: $ curl https://raw.github.com/creationix/nvm/master/install.sh | sh After running the install, I restart the terminal and attempt to install Node.js with this…
jordan
  • 9,570
  • 9
  • 43
  • 78
686
votes
13 answers

bodyParser is deprecated express 4

I am using express 4.0 and I'm aware that body parser has been taken out of the express core, I am using the recommended replacement, however I am getting body-parser deprecated bodyParser: use individual json/urlencoded middlewares…
Melbourne2991
  • 11,707
  • 12
  • 44
  • 82