tagged [node.js]
Mongoose use of .select() method
Mongoose use of .select() method I'm pretty confused with the use of the `select` method. This is how I use it, and it's wrong: What I'm trying to achieve is simply to select from the transactions in ...
- Modified
- 3 Mar at 17:30
Node.js, can't open files. Error: ENOENT, stat './path/to/file'
Node.js, can't open files. Error: ENOENT, stat './path/to/file' I have developed a node.js program using the express framework on my computer, where it runs fine with no complaints. However, when I ru...
How to convert CSV to JSON in Node.js
How to convert CSV to JSON in Node.js I am trying to convert csv file to json. I am using . Example CSV: Desired JSON: I tried node-csv parser library.But the output is like array not like I expected....
- Modified
- 2 Jul at 14:45
How to pass parameter to a promise function
How to pass parameter to a promise function this might seem a silly question but I am a newbie in this topic. I am working on promises on node js. And I want to pass parameter to a promise function. H...
- Modified
- 16 Dec at 20:9
NPM warn message about deprecated package
NPM warn message about deprecated package I am installing a module globally and NPM says > "npm WARN deprecated lodash@1.0.2: lodash@
Render basic HTML view?
Render basic HTML view? I have a basic Node.js app that I am trying to get off the ground using the Express framework. I have a `views` folder where I have an `index.html` file. But I receive the foll...
- Modified
- 13 Jun at 08:48
Secure random token in Node.js
Secure random token in Node.js In [this question](https://stackoverflow.com/questions/8838624/nodejs-send-email-on-registration/8842959#8842959) Erik needs to generate a secure random token in Node.js...
- Modified
- 23 May at 12:10
Changing Node.js listening port
Changing Node.js listening port I just installed node.js on Windows. I have this simple code which does not run: I get: Error: listen EADDRINUSE Is there a that tells node.js to listen on a specific p...
- Modified
- 29 Aug at 15:25
How to clear https proxy setting of NPM?
How to clear https proxy setting of NPM? How can I clear the previous ssl proxy setting of NPM? well, I search a lot, but all post I got is mainly about how to `set` proxy in corporate network. I try ...
How to properly export an ES6 class in Node 4?
How to properly export an ES6 class in Node 4? I defined a class in a module: But I get the following error message: ``` TypeError: Cannot set property 'AspectType' of undefined at Object.
- Modified
- 1 Dec at 02:6
ERROR in Cannot find module 'node-sass'
ERROR in Cannot find module 'node-sass' Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3 When I run npm start in my angularjs project I get this error: After this I run: Now I get thi...
- Modified
- 8 Jan at 09:59
How to run Gulp tasks sequentially one after the other
How to run Gulp tasks sequentially one after the other in the snippet like this: ``` gulp.task "coffee", -> gulp.src("src/server/**/*.coffee") .pipe(coffee {bare: true}).on("error",gutil.log) ...
- Modified
- 22 Aug at 20:24
"Cannot GET /" with Connect on Node.js
"Cannot GET /" with Connect on Node.js I'm trying to start serving some static web pages using `connect` like this: So I added a simple `index.html` at the `/public` directory on the same directory
Get the _id of inserted document in Mongo database in NodeJS
Get the _id of inserted document in Mongo database in NodeJS I use NodeJS to insert documents in MongoDB. Using `collection.insert` I can insert a document into database like in this code: How can I g...
- Modified
- 23 Jan at 13:59
Forwarding port 80 to 8080 using NGINX
Forwarding port 80 to 8080 using NGINX I'm using LEMP stack and Node JS on my debian server. Nginx works on port 80 and Node JS on 8080. I created new subdomain: cdn.domain.com for nodejs app. Current...
Node Sass does not yet support your current environment: Linux 64-bit with false
Node Sass does not yet support your current environment: Linux 64-bit with false Getting this error on Arch Linux with node-sass. I'm using it with [gulp-sass](https://github.com/dlmanning/gulp-sass)....
How to make remote REST call inside Node.js? any CURL?
How to make remote REST call inside Node.js? any CURL? In , other than using child process to make call, is there a way to make CURL call to remote server API and get the return data? I also need to s...
Read a file in Node.js
Read a file in Node.js I'm quite puzzled with reading files in Node.js. ``` fs.open('./start.html', 'r', function(err, fileToRead){ if (!err){ fs.readFile(fileToRead, {encoding: 'utf-8'}, functi...
- Modified
- 30 Jul at 13:41
Setting Environment Variables for Node to retrieve
Setting Environment Variables for Node to retrieve I'm trying to follow a tutorial and it says: > There are a few ways to load credentials. 1. Loaded from environment variables, 2. Loaded from a JSON ...
- Modified
- 28 Oct at 08:51
node.js Error: connect ECONNREFUSED; response from server
node.js Error: connect ECONNREFUSED; response from server I have a problem with this little program: ``` var http = require("http"); var request = http.request({ hostname: "localhost", port: 8000,...
- Modified
- 22 Sep at 21:22
Callback after all asynchronous forEach callbacks are completed
Callback after all asynchronous forEach callbacks are completed As the title suggests. How do I do this? I want to call `whenAllDone()` after the forEach-loop has gone through each element and done so...
- Modified
- 7 Aug at 00:57
Node.js - SyntaxError: Unexpected token import
Node.js - SyntaxError: Unexpected token import I don't understand what is wrong. Node v5.6.0 NPM v3.10.6 The code: The error: ``` SyntaxError: Unexpected token import at exports.runInThisContext (vm...
- Modified
- 15 Nov at 16:9
Find (and kill) process locking port 3000 on Mac
Find (and kill) process locking port 3000 on Mac How do I find (and kill) processes that listen to/use my TCP ports? I'm on macOS. Sometimes, after a crash or some bug, my Rails app is locking port 30...
The difference between "require(x)" and "import x"
The difference between "require(x)" and "import x" I've just started working on a small node project that will interface with a MongoDB. However, I cannot seem to get the relevant node modules to impo...
- Modified
- 14 Feb at 05:11
How do I test a single file using Jest?
How do I test a single file using Jest? I am able to test multiple files using Jest, but I cannot figure out how to test a single file. I have: - `npm install jest-cli --save-dev`- `package.json`- Run...
Embedding a lightweight web server into a .net application (node.js)?
Embedding a lightweight web server into a .net application (node.js)? I have a project built with Awesomium built in .NET and it requires the use of Flash. Flash throws security errors trying to acces...
- Modified
- 31 Jul at 18:4
How to Create and Use Enum in Mongoose
How to Create and Use Enum in Mongoose I am trying to create and use an `enum` type in Mongoose. I checked it out, but I'm not getting the proper result. I'm using `enum` in my program as follows: My ...
How do I pass command line arguments to a Node.js program?
How do I pass command line arguments to a Node.js program? I have a web server written in [Node.js](http://en.wikipedia.org/wiki/Node.js) and I would like to launch with a specific folder. I'm not sur...
- Modified
- 14 Jun at 04:3
'node' is not recognized as an internal or external command
'node' is not recognized as an internal or external command I've been working with `node.js` `v0.6.3`, locally installed on at `C:\Program Files\Nodejs`. I recently upgraded to (by running the install...
- Modified
- 14 Nov at 10:24
possible EventEmitter memory leak detected
possible EventEmitter memory leak detected I am getting following warning: ``` (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase...
- Modified
- 11 Dec at 04:6
How do I get the domain originating the request in express.js?
How do I get the domain originating the request in express.js? I'm using express.js and I need to know the domain which is originating the call. This is the simple code How do I get the domain from th...
- Modified
- 19 Jun at 09:56
Read file from aws s3 bucket using node fs
Read file from aws s3 bucket using node fs I am attempting to read a file that is in a aws s3 bucket using I've been able to download and upload a file using the node aws-sdk, but I am at a loss as to...
- Modified
- 29 Mar at 19:26
ReadFile in Base64 Nodejs
ReadFile in Base64 Nodejs I'm trying to read an image from client side encoded in base64. How to read with nodejs? My code: ``` // add to buffer base64 image var encondedImage = new Buffer(image.name,...
- Modified
- 17 May at 16:20
How to create JSON object Node.js
How to create JSON object Node.js I am trying to create a JSON object in Node.js without any success. For example an object like this: ``` { 'Orientation Sensor': [ { sampleTime: '1450632410296', ...
- Modified
- 7 Aug at 05:25
sequelize findAll sort order in nodejs
sequelize findAll sort order in nodejs I'm trying to output all object list from database with sequelize as follow and want to get data are sorted out as I added id in where clause. ``` exports.getSta...
- Modified
- 28 Mar at 09:50
Including JavaScript class definition from another file in Node.js
Including JavaScript class definition from another file in Node.js I'm writing a simple server for Node.js and I'm using my own class called `User` which looks like: ``` function User(socket) { this...
- Modified
- 15 Mar at 04:58
In Node.js, how do I "include" functions from my other files?
In Node.js, how do I "include" functions from my other files? Let's say I have a file called app.js. Pretty simple:
- Modified
- 27 Apr at 00:9
Is there a way to force npm to generate package-lock.json?
Is there a way to force npm to generate package-lock.json? I deleted it by accident and have made many changes to `package.json` since. An `npm install` or `npm update` do not generate `package-lock.j...
- Modified
- 10 Jun at 18:41
How do I convert an existing callback API to promises?
How do I convert an existing callback API to promises? I want to work with promises but I have a callback API in a format like: ### 1. DOM load or other one time event: ### 2. Plain callback: ###
- Modified
- 2 Oct at 14:8
Uploading file using POST request in Node.js
Uploading file using POST request in Node.js I have problem uploading file using POST request in Node.js. I have to use `request` module to accomplish that (no external npms). Server needs it to be mu...
- Modified
- 19 Dec at 13:25
NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'
NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0' When creating a new Angular 5 project: node version: 8.9.2 npm version: 5.5.1 My Command is: The Error is: ...
- Modified
- 12 Jul at 08:43
Get and Set a Single Cookie with Node.js HTTP Server
Get and Set a Single Cookie with Node.js HTTP Server I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few...
- Modified
- 7 Jul at 01:33
Conflict: Multiple assets emit to the same filename
Conflict: Multiple assets emit to the same filename I'm a webpack rookie who wants to learn all about it. I came across a conflict when running my webpack telling me: > ERROR in chunk html [entry] app...
- Modified
- 19 May at 07:37
How to display nodejs raw Buffer data as Hex string
How to display nodejs raw Buffer data as Hex string The following code uses SerialPort module to listen to data from a bluetooth connection. I am expecting to see a stream of data in Hexadecimal forma...
Authenticating socket io connections using JWT
Authenticating socket io connections using JWT How can I authenticate a socket.io connection? My application uses a login endpoint from another server (python) to get a token, how can I get use that t...
How do you send images to node js with Axios?
How do you send images to node js with Axios? Is there a way to send an array of images (or a single image) to node using axios? The axios code I'm using(I'm using react js on the front end): ``` onFo...
- Modified
- 10 Apr at 07:22
How to use underscore.js as a template engine?
How to use underscore.js as a template engine? I'm trying to learn about new usages of javascript as a serverside language and as a functional language. Few days ago I heard about node.js and express ...
- Modified
- 20 Jun at 09:12
How to extract request http headers from a request using NodeJS connect
How to extract request http headers from a request using NodeJS connect I'd like to get the "Host" header of a request made using Node JS's connect library bundle. My code looks like: The documentatio...
- Modified
- 30 Oct at 21:30
Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused while trying this mongo command in ubuntu I am getting this error. ``` ritzysystem@ritzysystem-Satellite-L55-A:~$ mongo Mon...
nvm is not compatible with the npm config "prefix" option:
nvm is not compatible with the npm config "prefix" option: I am trying to run another NodeJS version with `nvm` but getting this error: ``` $ nvm use v4.2.4 nvm is not compatible with the npm config "...