Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Share tech news, updates, or what's on your mind.

Sign up to Post

I've gotten spoiled using Nodemon and while I've got that installed on the app that I'm working on (I didn't build it, I'm just working on it), it doesn't restart the server in the way I'm accustomed to and I don't know why.

Here's the way things look on my Command Line:

b.gust@AHA-DT-BGUST2 MINGW64 /c/wamp64/www/bsmart (BRUCE-code-cleanup)
$ npm start

> cams@1.0.0 start C:\wamp64\www\bsmart
> nodemon index.js

[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
Listening on PORT: 3000

Open in new window

...and here are my scripts:

  "name": "cams",
  "version": "1.0.0",
  "description": "Client Acquisition Management System",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
	"start": "nodemon index.js"
  "author": "Mitch Cannon",
  "dependencies": {
    "aws-sdk": "^2.382.0",
    "bcrypt": "^3.0.2",
    "body-parser": "^1.18.3",
    "connect-mongo": "^2.0.3",
    "csv-stream": "^0.2.0",
    "dotenv": "^6.2.0",
    "express": "^4.16.4",
    "express-fileupload": "^1.0.0",
    "express-session": "^1.15.6",
    "express-sessions": "^1.0.6",
    "js-md5": "^0.7.3",
    "jsonwebtoken": "^8.4.0",
    "lodash": "^4.17.10",
    "moment": "^2.23.0",
    "moment-timezone": "^0.5.23",
    "mongodb": "^3.1.10",
    "mongoose": "^5.4.0",
    "multer-s3": "^2.9.0",
    "node-utils": "",
    "nodemailer": "^6.2.1",
    "nodemon": "^2.0.2",
    "papaparse": "^4.6.2",
    "request": "^2.88.0",
    "": "^2.2.0",
    "twig": "^1.12.0",
    "unzipper": "^0.9.11",
    "uuid": "^3.3.2",
    "validator": "^10.10.0"

Open in new window

What am I missing that would allow for Nodemon to operate in the way I'm accustomed, as far as me making a change in the code and the server automatically restarting?
what are some of the common issues , one might run into using sequelize ORM in a node js environment.

I have heard with application and database grows large and complex , and due to how node js works , single threaded , using sequelize ORM might turn into lot of complex coding.

I haven't tried it, but would like to see if there are any common issues that people have run into .
I have a 3-node Hyper-V HA cluster running Server 2019. I have everything identical, except I am trying to solve two problems:
I am pinging from a laptop on the same network as the nodes. Node 1 returns pings with higher-than-normal latency compared with the other two nodes- Normally they are <1ms-1ms. Node 1 returns a range from 1-40ms with drops about .5%-1% of the time. All nodes plugged into the same switches. Each node has 8 network adapters, 6 are teamed as "cluster" and two are teamed as "backup". The ping times are weird when the backups are not running, not sure about during backup windows. All four virtual adapters on all three nodes have statically-assigned MAC addresses that are unique and were set up to address other issues that Microsoft has acknowledged are actual issues. The 4 adapters on each server with these static MAC's are the two teams I mentioned and the Hyper-V switch associated with each team- So we have a vEthernet Cluster, a vEthernet Backups, Cluster, and Backups, each team is assigned to a Hyper-V switch. Each of the switch adapters is assigned a static IP address on the two networks- for example, node 1 is on Cluster and on Backups. Both networks are routable to each other.
On node three, I have a weird problem, andit might be related- ipconfig /all shows two IP addresses on the Cluster interface- and Both are statically assigned (No DHCP server on the network). When I go …
it is just for prototype testing.
Could you recommand?
Setting up SAML for SSO sig on to our LMS....
- Click the link for Sign in with SAML SSO
- Takes me to login page for organization
- using username/ password the web page throws an error:
Error details
Activity ID: 39309994-5de1-4c42-2300-0080000000fa
Relying party: MAU LMS
Error details: MSIS3200: No AssertionConsumerService is configured on the relying party trust '' that is a prefix match of the AssertionConsumerService URL '' specified by the request.
Node name: b0f8a440-7efb-4790-87e2-494c2fde6425
Error time: Fri, 03 Jan 2020 15:32:39 GMT
Cookie: enabled
User agent string: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36

- On the ADFS Event Viewer I get:

Encountered error during federation passive request.

Additional Data

Protocol Name:

Relying Party: 

Exception details:
Microsoft.IdentityServer.Service.Policy.PolicyServer.Engine.AssertionConsumerServiceUrlDoesNotMatchPolicyException: MSIS3200: No AssertionConsumerService is configured on the relying party trust '' that is a prefix match of the AssertionConsumerService URL '' specified by the request.…
I have a ReactJS app I’ve built in dev that works. The development environment has NodeJS installed on the Windows PC computer. Thus, the backend Express database API is able to run. I have to start that manually in this dev environment. Then I am able to browse to the development ReactJS application and it all works.

For a production system, I would need the backend portion running automatically so the React App would work whenever accessed.  Since I have never done this before, I don't know what requirements are needed to facilitate this project.

For example: Can it run on a shared web hosting account (ie. Godaddy or something comparable?) or does it require a dedicated server?, etc.  If it can be run on a shared hosting server, what is the process to get the backend portion installed, etc.

Instructions or guidance on what is needed to move this from the dev environment to a production environment is greatly appreciated.
Hi experts,
  I want to arrange my customer's receipt base on the code below. This code is working but there's no good arrangement of an
  item. I wish to have a result like this; Any help please..  

     Qty                Price            Amount
            1.25        10.00                   12.50
        120.00     1.75.00                210.00
  12,000.00      1.75.00          21,000.00

  function ePrint(){
  	const {PosPrinter} = require('electron').remote.require("electron-pos-printer");
  	const print_data = [
  		 {type: 'text', value: 'Sample store', style: 'text-align:center;font-size:19px;'},
  		 {type: 'text', value: 'Qty' + 'Price' + 'Amount', style: 'text-align:center;font-size:14px;'},
  		 {type: 'text', value: '1.25' + '10.00' + '12.50', style: 'text-align:center;font-size:14px;'},
       {type: 'text', value: '120.00' + '1.75' + '210.00', style: 'text-align:center;font-size:14px;'},
       {type: 'text', value: '12,000.00' + '1.75' + '21000.00', style: 'text-align:center;font-size:14px;'},
  	PosPrinter.print(print_data, {
  		 //printerName: 'EPSON TM-T88IV Receipt',
       printerName: 'EPSON TM-U220 Receipt',
  		 preview: false,
  		 width: '100%',
  		 margin: '0 0 0 0',
  		 copies: 1,
  	 .then(() => {
  		 //Do something here..
  	 .catch((error) => {

Open in new window


I've just built functionality in my Node.js app that allows me to create Jira issues via Jira API. I'm using simple login with e-mail address and token + 'request' library to make requests. It works great when I launch it from in my local environment but I keep on getting 401 - Unathorized when I deploy the app to AWS EC2. What could be the reason for this issue? Below is the example request that works when fired locally:

const headers = {
  'Authorization': 'Basic ' + Buffer.from(jiraUser + ':' + jiraPassword).toString('base64'),
  'X-Atlassian-Token': 'no-check',
  'Content-Type': 'application/json',

Open in new window

[code]router.get('/jira/priority', AuthGuard.verify, (req, res, next) => {
  request.get({url: jiraUrl + 'priority', headers: headers}, (err, resp) => {
    // logic

Open in new window


The only thing that was coming to my mind is the request origin, that might be different when firing requests from AWS.
Node.js and EJS

I have a html page in node js using ejs template wherein i have main checkbox for Hobbies(x) with id hobby with checkbox check by default once the page loads .and underneath i have 5 options(a,b,c,d,e) . these sub checkbox underneath hobbies are also checked by default.

I am wondering how do i write a java script function inside node.js router so that when box is unchecked no result should get displayed in node.js console and i should be able to send data to mongodb collection.

Please note that i am able to access the checkbox with id req.body.hobbyid when selected and send this data to backend server. However when i unselect the parent checkbox i am getting that value is undefined in node.js console.

Code snippet below

if (req.body.hobby[0]) {
      console.log(a); //here x can be any value
if (req.body.hobby[1]) {
      console.log(b); //here y can be any value
if (req.body.hobby[2]) {
      console.log(c); //here x can be any value
if (req.body.hobby[3]) {
      console.log(d); //here y can be any value

// code to connect to mongodb which i am not giving here which works very well when i check the main checkbox for hobby.

I want to achieve a way wherein when main parent checkbox(here which is hobby with id hobbymain is unchecked it should store a value as "False" and set the value as "Not submitted" in db and store in some variable which i can later pick the send to backend server.

Please note that when all checkbox are checked it …
Ran the command npm start to boot up my Magic Mirror with the MMM-Facial-Recognition module and I am given this error.  I am not sure how to fix it.The error I am given
I am using sequelize in node.js. At the moment I can search multiple tables and produce the the results as data.  I have done so using the following code:

router.get("/alldata", (req, res) => 

Promise.all([chemical_bays.findAll(), electricals.findAll(), fire_services.findAll(), instruments.findAll(), mechanicals.findAll(), microwaves.findAll(), tools.findAll(), water_cays.findAll(), buildings.findAll(), substations.findAll(), fences_gates_cctv.findAll(), steam_plant_other.findAll(), information_technology.findAll(), ])
.then((data) => {  res.render('gigs', {gigs: [[0],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]] }) }).catch(err => console.log(err)));

Open in new window

However, I wish now to count the results and have them displayed, however, if I use the aggregate attribute, "count", I am receiving an error. Here is the code I am trying to use:

router.get("/alldata", (req, res) => Promise.all([chemical_bays.findAll({attributes: ['id', [sequelize.fn('count', sequelize.col('id')), 'count']],
group : [''],
raw: true,
order: sequelize.literal('count DESC')}), electricals.findAll({attributes: ['id', [sequelize.fn('count', sequelize.col('id')), 'count']],
group : [''],
raw: true,
order: sequelize.literal('count DESC')}), fire_services.findAll({attributes: ['id', [sequelize.fn('count', sequelize.col('id')), 'count']],
group : 

Open in new window

I'm getting some error like this:

MongoError: E11000 duplicate key error collection: auth.users index: email_1 dup key: { email: "" }

Any ideas?

my code
hi am geting the following error
ERROR in src/app/tasks/tasks-add/tasks-add.component.ts:24:17 - error TS2345: Argument of type '(newTask: Task) => void' is not assignable to param
eter of type '(value: Task[]) => void'.
  Types of parameters 'newTask' and 'value' are incompatible.
    Type 'Task[]' is missing the following properties from type 'Task': id, name, completed, dueDate

24                 (newTask: Task) => {

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

my code is
import { Component, OnInit } from '@angular/core';
import { Task } from '../task.model';
import {TaskService} from '../task.service';

    selector: 'app-tasks-add',
    templateUrl: './tasks-add.component.html',
    styleUrls: ['./tasks-add.component.css']
export class TasksAddComponent implements OnInit {

    addTaskValue: string = null;

    constructor(private taskService: TaskService) { }

    ngOnInit() {


    onTaskAdd(event) {
        let task: Task = new Task(,false, this.getTodayAsString());
                (newTask: Task) => {
                    // clear the input
                    this.addTaskValue = ' ';

    getTodayAsString() {

Open in new window

I am using the handlebars template in node.js. Currently, the thumbnail images from the database are displaying at a width and height of 70 which is specified in the code. See below. How can I allow the user to click on the image in handlebars and see a larger rendition of the photo?
The current images are too small to see but I would only like for them to be increased upon clicking them.

<img id="img" src="/uploads/{{photo_image}}" width="70" height="70">
Hello, I am trying to automate something at work. I cannot use the actual code because the company is picky about privacy. The example I show would be similar and easy for me to use it the same way. I have begun understanding something about using The information I read showed how to connect to a web socket and emit data to connected web sockets. I now realize what web sockets can do. I am aware of how to set up a server and create an index.js file that sets up a connection. My question is how via a command line (Windows 10) could I make a webpage run JavaScript. In the code I show for the index.html page how could it run the sayHello function from a command-line command sent to the page? Thanks

<!doctype html>
		<meta charset="utf-8">
			<title>Untitled Document</title>
			<script src=""></script>	
			<script type="text/javascript">
				var h = 'Hello';
				var socket = io.connect('http://localhost:4561');
				function sayHello() {


Open in new window

Can you help with this error.

ran the command npm install --global.

I see the below error

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /Users/sdatla/build_tools/node-v8.15.1-darwin-x64-npm-5.6.0/lib/node_modules/.staging/Newton-7c7da797/node_modules/@babel/code-frame
npm ERR! dest /Users/sdatla/build_tools/node-v8.15.1-darwin-x64-npm-5.6.0/lib/node_modules/.staging/@babel/code-frame-bbf22dc8
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/sdatla/build_tools/node-v8.15.1-darwin-x64-npm-5.6.0/lib/node_modules/.staging/Newton-7c7da797/node_modules/@babel/code-frame' -> '/Users/sdatla/build_tools/node-v8.15.1-darwin-x64-npm-5.6.0/lib/node_modules/.staging/@babel/code-frame-bbf22dc8'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sdatla/.npm/_logs/2019-08-20T18_47_33_888Z-debug.log
I need to have this converted to JavaScript or TypeScript whichever is easier.

public static SqlDataReader ExecuteReader(string cmd, SqlConnection sqlConnection, SqlParameter[] parameters = null)

            SqlCommand command = null;

                SqlDataReader result;
                command = new SqlCommand(cmd, sqlConnection);
                command.Connection.ConnectionString = DB_Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandTimeout = 0;
                AssignParameters(command, parameters);
                result = command.ExecuteReader();
                return result;

            catch (Exception ex)
//Error trap system


Open in new window

I have added a command in scripts section of package.json to update one of the one of the dependencies.

When i run npm install, is there a way to tell the npm install to pick up specific package.json file?

Not sure how to get the npm install to use the package.json located in a local directory.

If i do a yarn install, i see it uses the package.json that was in the local directory.

If i use npm install -g command, the install does not use package.json from the local directory.
Hi. I need to write a javascript parser. My goal is to fetch the object definition given an oid.

This is the file :


Thank you.
So, I have deployed what I have done on my project so far to Heroku only to discover that that any images you upload to their server are deleted periodically! Not super helpful.

So, that means I have to either store the images in the database which I don't want to do, or upload to a cloud server. Before setting this up, I was using sharp to resize and compress the uploaded image. So, I uploaded the file into memory, resized/compressed it and then wrote it to a new file. I am uploading to google cloud storage.

I have the upload to the cloud working but it is uploading the original image, not the resized one. I think that it is because the cloud upload isn't uploading the one from memory but rather the original uploaded file.

This is the route:

Open in new window


// save image to memory instead of to disk
const multerStorage = multer.memoryStorage();

const upload = multer({
  storage: multerStorage,
  fileFilter: multerFilter

// upload the image
exports.uploadUserPhoto = upload.single("bgImg");

//resize and compress image
exports.resizeUserPhoto = (req, res, next) => {
  if (!req.file) return next();

  req.file.filename = `hero-${}.jpeg`;

  // get the image from memory
    .resize(1800, 948, {
    .jpeg({ quality: 80 })


Open in new window

Open in new window

Needs some advice regarding REACT with an Express front end for API database requests.  I have added the proxy entry the package.json file.  However, the api requests are still be served by the REACT app.  I need some advice on what I am doing wrong.

Here is my package.json file:
"name": "ubwo",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "16.8.6",
"react-dom": "16.8.6",
"react-redux": "7.1.0",
"react-router": "5.0.1",
"react-router-dom": "5.0.1",
"react-scripts": "3.0.1",
"redux": "4.0.1",
"redux-thunk": "2.3.0"
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eslintConfig": {
"extends": "react-app"
"browserslist": {
"production": [
"not dead",
"not op_mini all"
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
"resolutions": {
"browserslist": "4.6.2",
"caniuse-lite": "1.0.30000974"

Open in new window


I am trying to establish communication between HMI and PLC by using the Raspberry Pi. The existing setup between HMI directs to PLC via serial communication and protocol on Modbus RTU.

I am trying to put Raspberry Pi between HMI and PLC. Raspberry pi will be master serial to pull data from PLC via Serial Modbus RTU and be slave serial for HMI. HMI will be master to pull data from raspberry pi.

How I can achieve this? I am trying this to get some extra data from plc for monitoring purpose and didn't disturb the existing system.
I am attempting to write code in node.js to edit a record which has a file location for the image's url in the database.  I was able to edit all the other field columns pretty well. However, it appears that for security reasons, editing a image is not easily allowable....but there must be a workaround this in order to edit a record with an image file's url to upload another image. I keep getting this message:

Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

Here is my code for the form file upload:
<label for="file">Profile Photo:</label>
        <input type="file" name="image" id="image" onChange={this.uploadFile}>

Open in new window

Here is the frontend code for editing all records which I added the image value to:

$(document).ready(() => {
    $(document).on('click', '.edit', function (e) {
        action: $("href"),
        //action: "/station", // PATH TO POST NEW STATION DATA ?
        method: "PUT"
      var value = $("div").find("input:hidden").val();
      value = JSON.parse(value);

      $("#store", "#modalStationForm").val(value.Station);
      $("#image", "#modalStationForm").val(value.Image);

Open in new window

I have a file  from CA (certificate authority) .crt file with multiple BEGIN CERTIFICATE and END CERTIFICATE snippets inside.  I have a node js program to make my site https.
This program takes sslKey": "private-key.pem", sslCertificate": "lws-cert.pem". Now i assume i have the .crt file which can be renamed as lws-cert.pem and used in the program and what about private key ?
Am i missing something ? Is my aproach correct ?
I need to performance tune front end application running in node js ,d3 js , html , javascript , css with express server and  with back end in war file  done in sbt deployed on tomcat using spark scala mongdb hive kafka mysql hadoop. Let me know the best tools to monitor and performance tune the app for speed , good response etc., Thank you in advance.






Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Top Experts In