tagged [node.js]

Mongoose - What does the exec function do?

Mongoose - What does the exec function do? I came across a piece of Mongoose code that included a query findOne and then an exec() function. Ive never seen that method in Javascript before? What does ...

19 Jan at 21:30

npm WARN npm npm does not support Node.js v9.1.0

npm WARN npm npm does not support Node.js v9.1.0 I updated to the latest node v9.1.0 and now npm doesn't work. > npm WARN npm npm does not support Node.js v9.1.0

10 Nov at 15:31

Folder structure for a Node.js project

Folder structure for a Node.js project I notice that Node.js projects often include folders like these: > /libs, /vendor, /support, /spec, /tests What exactly do these mean? What's the different betwe...

29 Dec at 10:35

DOM element to corresponding vue.js component

DOM element to corresponding vue.js component How can I find the vue.js component corresponding to a DOM element? If I have Is there a vue method equivalent to the jQuery

2 Feb at 06:55

can you host a private repository for your organization to use with npm?

can you host a private repository for your organization to use with npm? Npm sounds like a great platform to use within an organization, curious if a private repo is possible, like with Nexus/Maven. N...

27 Sep at 21:1

How to change node.js's console font color?

How to change node.js's console font color? I had to change the console background color to white because of eye problems, but the font is gray colored and it makes the messages unreadable. How can I ...

14 Feb at 12:25

How to set custom favicon in Express?

How to set custom favicon in Express? I recently started working in Node.js and in the app.js file there is this line: Now, how do I set up my own custom favicon.ico?

12 Mar at 16:49

Passing a variable from node.js to html

Passing a variable from node.js to html I am trying to pass a variable from node.js to my HTML file.

15 Mar at 15:56

How to unpack an .asar file?

How to unpack an .asar file? I have packed my Electron application using the following command: Now, I need to unpack it and get the whole code back. Is there any way to do so?

7 Aug at 00:28

Global Variable in app.js accessible in routes?

Global Variable in app.js accessible in routes? How do i set a variable in `app.js` and have it be available in all the routes, atleast in the `index.js` file located in routes. using the express fram...

14 Aug at 11:1

How to sort a collection by date in MongoDB?

How to sort a collection by date in MongoDB? I am using MongoDB with Node.JS. I have a collection which contains a date and other rows. The date is a JavaScript `Date` object. How can I sort this coll...

12 Dec at 20:18

node.js remove file

node.js remove file How do I delete a file with node.js? [http://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback](http://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback) I do...

22 Feb at 13:51

What is the "__v" field in Mongoose

What is the "__v" field in Mongoose I'm using `Mongoose` version 3 with `MongoDB` version 2.2. I've noticed a `__v` field has started appearing in my `MongoDB` documents. Is it something to do with ve...

2 Jun at 15:6

npm install hangs

npm install hangs This is my `package.json`: Now, when I open the cmd and run `npm install`, the install hangs. What am I doing wrong?

1 Jun at 14:59

How can I update npm on Windows?

How can I update npm on Windows? I tried [this](http://davidwalsh.name/upgrade-nodejs): ...but it didn't work. How do I do this on Windows?

12 Jan at 15:28

How to host a Node.Js application in shared hosting

How to host a Node.Js application in shared hosting How to host a Node.Js application in a shared hosting I want to host a node.js application in shared hosting. Does anyone have any reference or docu...

19 Dec at 07:41

How to paginate with Mongoose in Node.js?

How to paginate with Mongoose in Node.js? I am writing a webapp with Node.js and mongoose. How can I paginate the results I get from a `.find()` call? I would like a functionality comparable to `"LIMI...

26 Jun at 15:18

module.exports vs exports in Node.js

module.exports vs exports in Node.js I've found the following contract in a Node.js module: I wonder what's the difference between `module.exports` and `exports` and why both are used here.

24 Jul at 12:33

send Content-Type: application/json post with node.js

send Content-Type: application/json post with node.js How can we make a HTTP request like this in NodeJS? Example or module appreciated.

25 Jan at 18:22

using process.env in TypeScript

using process.env in TypeScript How do I read node environment variables in TypeScript? If i use `process.env.NODE_ENV` I have this error : I have installed `@types/node` but it didn't help.

19 Jul at 15:11

How do I get the time of day in javascript/Node.js?

How do I get the time of day in javascript/Node.js? I want to get , 1 being 1am Pacific Time. How can I get that number in Node.JS? I want to know what time it is in Pacific time right now.

9 Sep at 06:5

How to change to an older version of Node.js

How to change to an older version of Node.js I am running Node.js version `v0.5.9-pre` on Ubuntu 10.10. I would like to be using version `v0.5.0-pre`. How do I roll back to the older version of node?

11 Jun at 02:25

HTML-parser on Node.js

HTML-parser on Node.js Is there something like Ruby's [nokogiri](http://nokogiri.org) on nodejs? I mean a user-friendly HTML-parser. I'd seen on Node.js modules page some parsers, but I can't find som...

30 Dec at 13:13

Code coverage with Mocha

Code coverage with Mocha I am using Mocha for testing my NodeJS application. I am not able to figure out how to use its code coverage feature. I tried googling it but did not find any proper tutorial....

Node update a specific package

Node update a specific package I want to update my Browser-sync . How can I achieve this? My current version of Browser-sync does not have the Browser-sync GUI :(

How can I set NODE_ENV=production on Windows?

How can I set NODE_ENV=production on Windows? In Ubuntu it's quite simple; I can run the application using: However, this doesn't work on Windows. Is there a configuration file where I can set the att...

8 Mar at 04:38

Fast way to concatenate strings in nodeJS/JavaScript

Fast way to concatenate strings in nodeJS/JavaScript I understand that doing something like It is relatively very slow, as the browser does that in `O(n)` . Is there a faster way of doing so without i...

Function to convert timestamp to human date in javascript

Function to convert timestamp to human date in javascript How to convert this timestamp `1382086394000` to `2013-10-18 08:53:14` using a function in javascript? Currently I have this function:

How to send a POST request from node.js Express?

How to send a POST request from node.js Express? Could someone show me the simplest way to send a post request from node.js Express, including how to pass and retrieve some data? I am expecting someth...

1 Sep at 09:20

npm ERR! Error: EPERM: operation not permitted, rename

npm ERR! Error: EPERM: operation not permitted, rename When I execute `npm install` I get this error > npm ERR! Error: EPERM: operation not permitted, rename C:\projects******\node_modules\react-async...

11 Mar at 10:5

Can you import node's path module using import path from 'path'

Can you import node's path module using import path from 'path' I prefer using the `import x from 'y'` syntax, but all I've seen online is `const path = require('path')`. Is there a way to import the ...

9 Jan at 17:15

How to determine the installed webpack version

How to determine the installed webpack version Especially during the transition from webpack v1 to v2, it would be important to programmatically determine what [webpack](https://webpack.js.org/) versi...

Is there a template engine for Node.js?

Is there a template engine for Node.js? I'm experimenting with building an entire web application using Node.js. Is there a template engine similar to (for example) the Django template engine or the l...

4 Jun at 13:55

What are "res" and "req" parameters in Express functions?

What are "res" and "req" parameters in Express functions? In the following Express function: What are `req` and `res`? What do they stand for, what do they mean, and what do they do? Thanks!

5 Feb at 19:39

HTTP GET Request in Node.js Express

HTTP GET Request in Node.js Express How can I make an HTTP request from within Node.js or Express.js? I need to connect to another service. I am hoping the call is asynchronous and that the callback c...

How to split and modify a string in NodeJS?

How to split and modify a string in NodeJS? I have a string : I want to parse each item after split and increment 1. So I will have: How can I do that in NodeJS?

28 Feb at 11:22

Is there a virtual environment for node.js?

Is there a virtual environment for node.js? I've searched the wiki modules page, but I can't find anything similar to virtualenv (python) or rvm. Anyone here separates node.js in their own env? I real...

Restart node upon changing a file

Restart node upon changing a file For someone who is coming from PHP background the process of killing node and starting it again after every code change, seems very tedious. Is there any flag when st...

17 Jul at 08:34

What is the difference between --save and --save-dev?

What is the difference between --save and --save-dev? What is the difference between: and: and: What does this mean? And what is really the effect of `--save` and `-dev` keywords?

20 Sep at 06:45

Calling Node.js from C# .NET

Calling Node.js from C# .NET Is it possible to call Node.js functions from a C# ASP.NET server? I found the Edge.js library, but as I understood, it allows Node.js to call into C#. I need the directly...

25 Oct at 17:30

Difference between "process.stdout.write" and "console.log" in node.js?

Difference between "process.stdout.write" and "console.log" in node.js? What is the difference between "process.stdout.write" and "console.log" in node.js? EDIT: Using console.log for a variable showe...

13 Feb at 22:59

How do I install a module globally using npm?

How do I install a module globally using npm? I recently installed Node.js and npm module on OSX and have a problem with the settings I think:

26 Jul at 19:29

cURL equivalent in Node.js?

cURL equivalent in Node.js? I'm looking to use information from an HTTP request using Node.js (i.e. call a remote web service and echo the response to the client). In PHP I would have used cURL to do ...

9 Feb at 19:2

How do I update Node.js?

How do I update Node.js? I did the following to update my npm: 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.)

8 Nov at 20:57

How to download a file with Node.js (without using third-party libraries)?

How to download a file with Node.js (without using third-party libraries)? How do I download a file with Node.js ? I don't need anything special. I only want to download a file from a given URL, and t...

29 Jan at 14:27

How to get a microtime in Node.js?

How to get a microtime in Node.js? How can I get the most accurate time stamp in Node.js? ps My version of Node.js is 0.8.X and the [node-microtime extension](https://github.com/wadey/node-microtime) ...

6 Mar at 06:42

How to list npm user-installed packages

How to list npm user-installed packages How do I list the user-installed / environment package in npm? When I do `npm -g list`, it outputs every package and their dependencies. Instead I'd like to see...

How to create streams from string in Node.Js?

How to create streams from string in Node.Js? I am using a library, [ya-csv](https://github.com/koles/ya-csv), that expects either a file or a stream as input, but I have a string. How do I convert th...

NodeJS w/Express Error: Cannot GET /

NodeJS w/Express Error: Cannot GET / This is what i have, the filename "default.htm" actually exists and loads when doing a readFile with NodeJS. The Error (in browser):

12 Nov at 07:22

How to create a directory if it doesn't exist using Node.js

How to create a directory if it doesn't exist using Node.js Is the following the right way to create a directory if it doesn't exist? It should have full permission for the script and readable by othe...

4 May at 16:43