tagged [node.js]

How to get all registered routes in Express?

How to get all registered routes in Express? I have a web application built using Node.js and Express. Now I would like to list all registered routes with their appropriate methods. E.g., if I have ex...

16 Jan at 14:2

How can I write a test which expects an 'Error' to be thrown in Jasmine?

How can I write a test which expects an 'Error' to be thrown in Jasmine? I'm trying to write a test for the [Jasmine Test Framework](http://jasmine.github.io/) which expects an error. At the moment I'...

8 Jan at 00:41

NPM ERR Code E401: Unable to authenticate, need: Bearer authorization

NPM ERR Code E401: Unable to authenticate, need: Bearer authorization I downloaded a NodeJS application from GitHub and facing the following error when executing npm install. ``` npm ERR! code E401 np...

6 Jan at 06:17

Sequelize Where statement with date

Sequelize Where statement with date I am using Sequelize as my backend ORM. Now I wish to do some `WHERE` operations on a Date. More specifically, I want to get all data where a date is between now an...

27 Dec at 20:0

ER_NOT_SUPPORTED_AUTH_MODE - MySQL server

ER_NOT_SUPPORTED_AUTH_MODE - MySQL server ## Failed at Connecting Node.js Server to MySQL-Database ---         I had installed on a , but decided that I wanted to use a SQL Database instead. I uninsta...

What is the --save option for npm install?

What is the --save option for npm install? I saw some tutorial where the command was: What does the `--save` option mean?

20 Dec at 13:0

What is Firebase Firestore 'Reference' data type good for?

What is Firebase Firestore 'Reference' data type good for? I'm just exploring the new Firebase Firestore and it contains a data type called [reference](https://firebase.google.com/docs/firestore/manag...

Enabling HTTPS on express.js

Enabling HTTPS on express.js I'm trying to get HTTPS working on express.js for node, and I can't figure it out. This is my `app.js` code. ``` var express = require('express'); var fs = require('fs'); ...

8 Dec at 12:29

How to fix Error: listen EADDRINUSE while using NodeJS?

How to fix Error: listen EADDRINUSE while using NodeJS? If I run a server with the port 80, and I try to use [XMLHttpRequest](https://github.com/driverdan/node-XMLHttpRequest) I am getting this error:...

6 Dec at 17:12

Steps to send a https request to a rest service in Node js

Steps to send a https request to a rest service in Node js What are the steps to send a https request in node js to a rest service? I have an api exposed like [(Original link not working...)](https://...

6 Dec at 11:0

Print a list of all installed node.js modules

Print a list of all installed node.js modules In a node.js script that I'm working on, I want to print all node.js modules (installed using npm) to the command line. How can I do this?

Configure Node.js to log to a file instead of the console

Configure Node.js to log to a file instead of the console Can I configure `console.log` so that the logs are written on a file instead of being printed in the console?

23 Nov at 15:48

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

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 ...

20 Nov at 19:58

What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that?

What could cause an error related to npm not being able to find a file? No contents in my node_modules subfolder. Why is that? I'm trying to run `npm install` in the angular project folder I got from ...

What is NODE_ENV and how to use it in Express?

What is NODE_ENV and how to use it in Express? This is my app that I'm currently running on production. ``` var app = express(); app.set('views',settings.c.WEB_PATH + '/public/templates'); app.set('vi...

18 Nov at 17:44

Export HTML table to CSV using vanilla javascript

Export HTML table to CSV using vanilla javascript I am trying to add a feature of csv download option in my website. It should convert the html table present in the website in to csv content and make ...

Node.js project naming conventions for files & folders

Node.js project naming conventions for files & folders What are the naming conventions for files and folders in a large Node.js project? Should I capitalize, camelCase, or under-score? Ie. is this con...

How to generate an MD5 file hash in JavaScript/Node.js?

How to generate an MD5 file hash in JavaScript/Node.js? How to write `functionToGenerateMD5hash` for this code? I already have `fileVideo` and I need to send the corresponding md5 hash to the server b...

24 Oct at 20:14

Find unused npm packages in package.json

Find unused npm packages in package.json Is there a way to determine if you have packages in your `package.json` file that are no longer needed? For instance, when trying out a package and later comme...

20 Oct at 13:10

How can I get the sha1 hash of a string in node.js?

How can I get the sha1 hash of a string in node.js? I'm trying to create a websocket server written in node.js To get the server to work I need to get the SHA1 hash of a string. What I have to do is e...

7 Oct at 07:13

Server Discovery And Monitoring engine is deprecated

Server Discovery And Monitoring engine is deprecated I am using Mongoose with my Node.js app and this is my configuration: ``` mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUni...

WebSocket connection failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

WebSocket connection failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED I am new to WebRTC and WebSockets and was following this tutorial to create a WebRTC demo project, but I am ...

30 Sep at 15:0

"React.Children.only expected to receive a single React element child" error when putting <Image> and <TouchableHighlight> in a <View>

"React.Children.only expected to receive a single React element child" error when putting and in a I have the following render method in my React Native code: ``` render() { const {height, width} = ...

Passing variables to the next middleware using next() in Express.js

Passing variables to the next middleware using next() in Express.js I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "`req.somevariab...

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,...

22 Sep at 21:22

What are express.json() and express.urlencoded()?

What are express.json() and express.urlencoded()? I cannot find any documentation on `express.json()` and `express.urlencoded()`. What do each of them do exactly?

21 Sep at 19:44

Command to remove all npm modules globally

Command to remove all npm modules globally Is there a command to remove all global npm modules? If not, what do you suggest?

17 Sep at 17:1

Get element height with Vuejs

Get element height with Vuejs I want to get the height of a div in order to make the height of another div matching it. I used the method clientHeight, but It doesn't return me the good value (smaller...

10 Sep at 05:19

SyntaxError: Cannot use import statement outside a module

SyntaxError: Cannot use import statement outside a module I've got an project that's giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My "index.js" is...

AccessDeniedException: User is not authorized to perform: lambda:InvokeFunction

AccessDeniedException: User is not authorized to perform: lambda:InvokeFunction I'm trying to invoke a lambda function from node. ``` var aws = require('aws-sdk'); var lambda = new aws.Lambda({ acce...

'react-scripts' is not recognized as an internal or external command

'react-scripts' is not recognized as an internal or external command I've got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks like `mav...

27 Aug at 08:14

Babel 6 regeneratorRuntime is not defined

Babel 6 regeneratorRuntime is not defined I'm trying to use async/await from scratch on Babel 6, but I'm getting `regeneratorRuntime` is not defined. .babelrc file package.json file .js file ``` "use ...

23 Aug at 08:50

How to install package from github repo in Yarn

How to install package from github repo in Yarn When I use `npm install fancyapps/fancybox#v2.6.1 --save`, so fancybox package at v2.6.1 tag will be installed. This behavior is described in [docs](htt...

17 Aug at 13:42

error Command failed with exit code 1. when I try to run yarn

error Command failed with exit code 1. when I try to run yarn I am learning reactjs - nodejs I was trying to run the server so I installed yarn, nodemon, express but when I try to run its saying error...

5 Aug at 13:49

How can I do Base64 encoding in Node.js?

How can I do Base64 encoding in Node.js? Does Node.js have built-in Base64 encoding yet? The reason why I ask this is that `final()` from `crypto` can only output hexadecimal, binary or ASCII data. Fo...

1 Aug at 22:11

How to set the content-type of request header when using Fetch APi

How to set the content-type of request header when using Fetch APi I am using npm 'isomorphic-fetch' to send requests. The problem I am experiencing is I am unable to set the content-type of the reque...

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

The NPM script 'start' exited without indicating that the create-react-app server was listening for requests

The NPM script 'start' exited without indicating that the create-react-app server was listening for requests I faced with this problem: ![enter image description here](https://i.stack.imgur.com/h8LpA....

18 Jul at 05:37

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: ...

12 Jul at 08:43

How to read file with async/await properly?

How to read file with async/await properly? I cannot figure out how `async`/`await` works. I slightly understand it but I can't make it work. I know, I could use `re

11 Jul at 14:26

Is there a way to get version from package.json in nodejs code?

Is there a way to get version from package.json in nodejs code? Is there a way to get the version set in `package.json` in a nodejs app? I would want something like this

How to programmatically send a 404 response with Express/Node?

How to programmatically send a 404 response with Express/Node? I want to simulate a 404 error on my Express/Node server. How can I do that?

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...

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...

How to fix "ReferenceError: primordials is not defined" in Node.js

How to fix "ReferenceError: primordials is not defined" in Node.js I have installed Node.js modules by 'npm install', and then I tried to do `gulp sass-watch` in a command prompt. After that, I got th...

14 May at 12:6

bower command not found

bower command not found I tried to install twitter bower on my Mac, and I used Then I tried `bower --help`, and the output was `bower command not found`. Why is that?

11 May at 03:26

add created_at and updated_at fields to mongoose schemas

add created_at and updated_at fields to mongoose schemas Is there a way to add created_at and `updated_at` fields to a mongoose schema, without having to pass them in everytime new `MyModel()` is call...

9 May at 13:40

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

Can a C# application communicate with Node.js code?

Can a C# application communicate with Node.js code? I have a C# application and a Node.js application. I would like to press a button in my C# application to send three arguments to a Node.js applicat...

3 May at 21:18

How to split string with newline ('\n') in Node?

How to split string with newline ('\n') in Node? Within Node, how do I split a string using newline ('\n') ? I have a simple string like `var a = "test.js\nagain.js"` and I need to get `["test.js", "a...

20 Apr at 23:46