Skip to main content

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
5401 votes
22 answers
1.9m views

What's the difference between tilde(~) and caret(^) in package.json?

After I upgraded to the latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are ...
Fizer Khan's user avatar
  • 91.3k
3220 votes
34 answers
2.3m views

Using async/await with a forEach loop

Are there any issues with using async/await in a forEach loop? I'm trying to loop through an array of files and await on the contents of each file. import fs from 'fs-promise' async function ...
Saad's user avatar
  • 52.8k
3094 votes
16 answers
1.2m views

What is the --save option for npm install?

I saw some tutorial where the command was: npm install --save What does the --save option mean?
Dmitri's user avatar
  • 35.8k
3085 votes
41 answers
1.8m views

How do I pass command line arguments to a Node.js program and receive them?

I have a web server written in Node.js and I would like to launch with a specific folder. I'm not sure how to access arguments in JavaScript. I'm running node like this: $ node server.js folder here ...
milkplus's user avatar
  • 33.9k
3018 votes
32 answers
2.2m views

Find the version of an installed npm package

How can I find the version of an installed Node.js or npm package? This prints the version of npm itself: npm -v <package-name> This prints a cryptic error: npm version <package-name> ...
Laurent Couvidou's user avatar
2924 votes
17 answers
1.0m views

What's the difference between dependencies, devDependencies, and peerDependencies in NPM package.json file?

This documentation answers my question very poorly. I didn't understand those explanations. Can someone say in simpler words? Maybe with examples if it's hard to choose simple words? Also added ...
Vitalii Korsakov's user avatar
2809 votes
42 answers
1.7m views

How can I update each dependency in package.json to the latest version?

I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don't mind fixing something if it breaks. What's ...
Raine Revere's user avatar
  • 32.7k
2483 votes
15 answers
1.1m views

Do I commit the package-lock.json file created by npm 5?

npm 5 was released today and one of the new features include deterministic installs with the creation of a package-lock.json file. Is this file supposed to be kept in source control? I'm assuming it'...
rink.attendant.6's user avatar
2357 votes
68 answers
3.0m views

Error message "error:0308010C:digital envelope routines::unsupported"

I created the default IntelliJ IDEA React project and got this: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (...
a1cd's user avatar
  • 24.2k
2328 votes
22 answers
1.2m views

How to exit in Node.js

What is the command that is used to exit? (i.e terminate the Node.js process)
700 Software's user avatar
  • 86.9k
2191 votes
17 answers
586k views

How to decide when to use Node.js?

I am new to this kind of stuff, but lately I've been hearing a lot about how good Node.js is. Considering how much I love working with jQuery and JavaScript in general, I can't help but wonder how to ...
Legend's user avatar
  • 116k
2171 votes
67 answers
2.4m views

How can I update Node.js and npm to their latest versions?

I just installed Node.js and npm. I installed npm for access to additional Node.js modules. After I installed Node.js and npm, I noticed that neither were the latest versions available. So my ...
Dail's user avatar
  • 21.9k
2111 votes
18 answers
2.1m views

Writing to files in Node.js

I've been trying to find a way to write to a file when using Node.js, but with no success. How can I do that?
Gjorgji's user avatar
  • 23k
1833 votes
42 answers
2.8m views

map function for objects (instead of arrays)

I have an object: myObject = { 'a': 1, 'b': 2, 'c': 3 } I am looking for a native method, similar to Array.prototype.map that would be used as follows: newObject = myObject.map(function (value, ...
Randomblue's user avatar
  • 115k
1765 votes
36 answers
2.9m views

How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

My version of node is always v0.6.1-pre even after I install brew node and NVM install v0.6.19. My node version is: node -v v0.6.1-pre NVM says this (after I install a version of node for the first ...
Dominic Tancredi's user avatar

15 30 50 per page
1
2 3 4 5
31571