Tag: r

60 votes
25 answers
1.5K views
In Node.js, how do I "include" functions from my other files?

Let's say I have a file called app.js. Pretty simple: var express = require('express'); var ap

avatar
Deedee
0 1 0 9
asked 07 September, 2021
61 votes
10 answers
1.1K views
Using Node.js require vs. ES6 import/export

In a project I'm collaborating on, we have two choices on which module system we can use: Importing modu

avatar
Chaya
0 1 0 9
asked 07 September, 2021
53 votes
17 answers
376 views
How can I get the full object in Node.js's console.log(), rather than '[Object]'?

When debugging using console.log(), how can I get the full object? const myObject = { "a":"a", "b":{

avatar
Royal
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
1.2K views
Using Node.js as a simple web server

I want to run a very simple HTTP server. Every GET request to example.com should get index.html served to it b

avatar
Elicia
0 1 0 9
asked 07 September, 2021
67 votes
23 answers
1.7K views
Where does npm install packages?

Can someone tell me where can I find the Node.js modules, which I installed using npm?

avatar
Sydney
0 1 0 9
asked 07 September, 2021
58 votes
26 answers
2.7K views
How do you get a list of the names of all files present in a directory in Node.js?

I'm trying to get a list of the names of all the files present in a directory using Node.js. I want outp

avatar
Shantay
0 1 0 9
asked 07 September, 2021
55 votes
24 answers
2.1K views
How to get GET (query string) variables in Express.js on Node.js?

Can we get the variables in the query string in Node.js just like we get them in $_GET in PHP? I know that in

avatar
Tana
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
1.6K views
How to fix npm throwing error without sudo

I just installed node and npm through the package on nodejs.org, and whenever I try to search or install somet

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
2.1K views
map function for objects (instead of arrays)

I have an object: myObject = { 'a': 1, 'b': 2, 'c': 3 } I am looking for a na

avatar
Dusty
0 1 0 9
asked 07 September, 2021
51 votes
7 answers
1.9K views
Read environment variables in Node.js

Is there a way to read environment variables in Node.js code? Like for example Python's os.environ[&apos

avatar
Joseph
0 1 0 9
asked 07 September, 2021
49 votes
30 answers
495 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 versi

avatar
Elicia
0 1 0 9
asked 07 September, 2021
60 votes
12 answers
2.5K views
What is the purpose of Node.js module.exports and how do you use it?

What is the purpose of Node.js module.exports and how do you use it? I can't seem to find any information

avatar
Benton
0 1 0 9
asked 07 September, 2021
47 votes
30 answers
3K views
How do I debug Node.js applications?

How do I debug a Node.js server application? Right now I'm mostly using alert debugging with print state

avatar
Virgil
0 1 0 9
asked 07 September, 2021
53 votes
19 answers
3.1K views
Writing 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 t

avatar
Majorie
0 1 0 9
asked 07 September, 2021
55 votes
12 answers
2.4K 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 pac

avatar
Dusty
0 1 0 9
asked 07 September, 2021
56 votes
27 answers
886 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 fil

avatar
Robt
0 1 0 9
asked 07 September, 2021
59 votes
17 answers
2.1K views
65 votes
30 answers
1K views
How do I pass command line arguments to a Node.js program?

I have a web server written in Node.js and I would like to launch with a specific folder. I'm not sure ho

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
56 votes
19 answers
2.9K 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 t

avatar
Roger
0 1 0 9
asked 07 September, 2021
54 votes
19 answers
2.1K views
How to use a keypress event in AngularJS?

I want to catch the enter key press event on the textbox below. To make it more clear I am using a ng-repeat t

avatar
Rudy
0 1 0 9
asked 07 September, 2021