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

Hi, please need guidance on how to fix the npm error. Thanks so much in advance.

# rpm --query centos-release

Open in new window

# node --version

Open in new window

# npm --version

    throw err;
Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /usr/lib/node_modules/npm/bin/npm-cli.js:18:11
    at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:86:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

Open in new window

Database Solutions Engineer FAQs
Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.


I am very new to nodejs but have been learning a lot these past few weeks.  I am trying to use passport to implement authentication but I am getting an error that I need to fix.  Any assistance would be much appreciated.  Here is the error I get..
node error
Below is part of my code:

const express = require('express');
const mongoose = require('mongoose');
const hbs = require('express-handlebars');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser')
const passport = require('passport')
const LocalStrategy = require('passport-local').Strategy
var User = require('./models/account')


//Persists data in memory inside of application
    secret: 'vendorSecret',
    resave: false,
    saveUninitialized: false

//Allows you to use static files

app.use('/vendor', vendorRouter)
app.use('/admin', adminRouter)

passport.use( new LocalStrategy(User.authenticate()) )     //<---Error on this line

app.listen(3000, ()=>{
  console.log("Server Listening");

Open in new window

Hi, I got this Multitrack Player to work on Node.js on a Node hosting service
I also got it to work locally on my PC.

I have Wordpress hosting at Dreamhost.

Now I want to include the Multitrack Player into the Wordpress page.
I need some help with that.

For a start, how can I simply 'insert' the player into my WP page?

Hello Experts,

I have a webpage and I need to get the data from a postgres db.  I will probably hire someone to actually do this, but I'd like to understand the process prior.  I think that I have to use node.js to get the data from the database.  Does that sound right?  Or is there a better way to get at the data?
HI experts ,
I have to  update nodejs version. I checked several links but  noway .  
This  is  the last link i tried

But  i find the same nodejs version
f.pngps : am using linux mint 17.2

Thankx for help .
I successfully got this example to work on my Windows 10 pc. (thanks to help from Expert it_saige)¬ificationFollowed=191140277#a42185760

I now want to host it on a GoDaddy hosting account I just signed up for.

I've never setup a Node.js website before - though I have worked with IIS/ASP sites for years.
Is it just a matter of copying the files to a particular folder (eg. root)?

Thanks for any help.
I'm trying to run this example here (of an HTML5 application)

It needs to run on Node.js - I am unfimilar with Node.js. (though ok with IIS)

I have downloaded Node.js and installed it. I have downloaded the ZIP file from GitHub.

Can someone please give me a step-by-step to enable me to open/run this one-page web file?

A demo is here
(pretty cool if you're a musician)

I am trying to connect to MongoDB in mongoDBatlas from my javascript but I keep getting the following error.

MongoError: connection 5 to closed
    at Function.MongoError.create (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\error.js:29:11)
    at TLSSocket.<anonymous> (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\connection\connection.js:202:22)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:101:20)
    at TLSSocket.emit (events.js:191:7)
    at _handle.close (net.js:511:12)
    at Socket.done (_tls_wrap.js:332:7)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at TCP._handle.close [as _onclose] (net.js:511:12)

Here's my code
const express = require('express')
const hbs = require('express-handlebars')
const mongoose = require('mongoose')
const bodyParser = require('body-parser')


const itemEntry = require('./models/toDoEntry.js')
const app = express()

app.get('/', function( req, res ) {
	itemEntry.find({}, function( err, itemEntries ) {

Open in new window

I am looking into Webpack 2 Code Splitting for a project but I'm not sure if I understand how code splitting works.

In my project I have 2 features.

Each feature consists of 4 or 5 files so the code for each feature has several javascript files where the code lives.

These javascript files are NOT ES6 Modules, just standard javascript files with code.

With Webpack 2 Code Splitting I intend to break all these files into 2 groups so that can load them on demand when needed.

So, what I'm thinking of doing with it is ...

1. Project Loads just the core

2. On demand the features will load when needed.

Would code splitting work in this circumstance and is this what it's for?
I am working on a project using, node, Webpack, babel and ES6.

Inside my project I've created a module which I want to load into the project at runtime.

The end result I'm looking for is that when the application will have different features. The code for each feature will be in a module.

The user can then enable or disable certain features at runtime.

How can I do this?
Get proactive database performance tuning online
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

As a junior, I'm a bit new to front end programming (crammed learning JS/other languages/NPM/NodeJS/etc within three months for my current role) so apologies if what I say doesn't make sense.

I've helped to build a UI for an application with the use of NPM/Node JS. The application stores data on a UNIX server. The UI accesses the data on the server (https://myhostname:8090/blah/blah) and presents the results with a nice UI. With the help of GIT, I've managed to do move all the src UI code onto the UNIX server. The purpose is for automation

While a specific file (in my UI code) specifies the UNIX server configuration, I've used NPM to build a bundle.js (Which bundles all the JS files into a single file) file. I move this bundles.js along with the index.html and CSS styling files to an appropriate directory in order to use Maven to build a JAR file. And with a start/stop server script to run the process to run  the code, I can just enter the UNIX hostname/port number in my browser window in order to access the UI and data. This all works.

However. I now need to generalise the server configuration in my bundle.js file as well as properties file on server side such that I'm not hard coding server configuration anywhere (meaning I can deploy the UI on any server with no issue). i.e. playing with "localhost" instead of the actual server hostname etc.

I want to try my best, but I need to acknowledge that I have no real server configuration experience and hence need a …

In Facebook, 1000's of people can like or frown or comment on certain columns.

In the Facebook API, am I able to easily message those people interested in the topic? are there ways, Apps to do this? Any costs?

This message page suggests billions? Really . . . .? . . .  here

Do I need to use Java or PHP coding in any way?

Hello Exchange Experts,

I have 1 DAG with 4 nodes with Exchange 2013, I would like to know if I could create 1 BD for my heath mailbox, I have read that is not a best practice to move them, but for my administration could be better. So my questions:
*  The health mailbox has to be local in each node? or I could have them all in one server
* Could I move the health mailbox to another DB, and another disk unit, in the same node?

Thanks a lot!
Hi All,

I have a 2 node hyper v cluster running a bunch of virtual machines.

I can successfully connect to the cluster via failover cluster manager with no issues. I have run the validate cluster tool which passes successfully also

When I right click on a node and select 'connect' I get the console window as expected, however it only works on hyper v host 1 not hyper v host 2.

When I also try and connect to the problem host via Hyper-V manager I receive the following:

Any suggestions?
Hello experts,

Is there any way to handle cuss words in
 Nodejs application.

Thank you
I have node installed on my laptop.

I have a folder that I want to use for my testing of angular:


node is installed here:


From within the nodejs directory I want to be able to start an http server like this:

C:\programfiles\nodejs> node server.js

which would start the http server and just wait, listening on some port like 5000

then, in a web browser like Chrome, I want to navigate to localhost and load an HTML file:


But the test.html file resides at this location:


I've been doing lots of reading on "express" and "connect" middleware, but I just can't seem to make it work.

For example:

I ran the following:

npm install connect -g


npm install serve-static -g

and then ran "node server.js"


var connect = require('connect');

var serveStatic = require('serve-static');

connect.createServer( serveStatic("../angularjs") ).listen( 5000);

Open in new window

gives this error:

TypeError: connect.createServer is not a function
Below is my  code,Can   anyone please  tell me why my window.onload function  does not  work? I am javascript newbie

// performs an AJAX get call asynchronously and puts the result into an element
function ajaxAsync(url, elementId) {
    var ajax = createAjaxRequestObj();
    ajax.onreadystatechange = function() {
        if (ajax.readyState == 4) {

//Here is my window.onload function
            window.onload = function(){
                document.getElementById(elementId).innerHTML = ajax.status == 200 || ajax.status == 304 ? ajax.responseText : "(an error has occurred - please try refreshing the page - " + ajax.status + ")";
            if (finishLoad) {
    }"GET", randomizeUrl(url), true);

Open in new window

best way to have users and roles and authenicate based on these users and  roles  and based in nodejs apis?
Hi Team,

I have a 2 node hyper V cluster running on windows server 2012 R2 ,i wanted to convert present LUN to CSV but i am not getting the option.

Watch the Recording: Learning MySQL 5.7
 Watch the Recording: Learning MySQL 5.7

MySQL 5.7 has a lot of new features. If you've dabbled with an older version of MySQL, it is definitely worth learning.

Hello expert,

 I have a piece of code which i used it in other, is it a correct way of doing it or any other way we can have

function addZero(i) {
	if (i < 10) {
		i = "0" + i;
	return i.toString();

Open in new window

//---  create current date in YYYY-MM-DD HH:MM:SS format ---//
function curDate() {
	var d = new Date();
	var crDate = d.getFullYear()
	+ '-' + addZero(d.getMonth() + 1)
	+ '-' + addZero(d.getDate())
	+ ' ' + addZero(d.getHours())
	+ ':' + addZero(d.getMinutes())
	+ ':' + addZero(d.getSeconds());
	return crDate;

Open in new window

Hello expert,

Any tools to analysis the code  like coding standards on angularjs and nodejs side

Thank you

Hi guys,

I am trying to figure out the best way to automatically pull down certain files from a server i was thinking a cron job would be the best way, i was wondering is there anything wrong with my script here and would there be a better way to do it?

The files are json files, and they are playlists on machines that could be currently in use

Something like
if(playlist.json file == error message){
//download json file again

It will also need to check which playlist is currently playing (before toggling each playlist using the script) and ensure it is set back to that same playlist after toggling each


Something like
var count = 0;
if(playlist.json file == error message && count<3){
//download json file again
count ++;
//load playlist into threadqueue
//must be issues downloading the playlist so revert to default playlist and flag us
Can anyone please  help? I  am trying to extract  an ID 254162  from  URL  http://localhost:9080/company_add.jsp?id=254162. I have  tried  to  write  as seen  below but I  when I  do  console.log,Java script  return /company_add.jsp only.Anything I am missing?.Thank you
var url=window.location.pathname;
            var  UrId=url.substring(url.lastIndexOf('=') + 1);

Open in new window

I am trying to login a user using an api request which passes the jwt token in the querystring, followed by a location.href call to redirect the user to a protected url(html page). On the server side for my jwt setup method I am setting up jwt with the following code:

app.use(expressJwt({secret: process.env.AUTH_KEY,
  credentialsRequired: true,
  getToken: function fromHeaderOrQuerystring (req) {
    if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
        return req.headers.authorization.split(' ')[1];
    } else if (req.query && req.query.access_token) {
      console.log('the access token = ' + req.query.access_token);
      return req.query.access_token;
    return null;
  }}).unless({path: [{ url: '/api/forgotpassword/', methods: ['PUT'] }, 
  { url: '/forgotpassword/', methods: ['GET'] }, 
  { url: '/api/login', methods: ['POST', 'PUT'] },
  { url: '/login', methods: ['GET'] },
  { url: '/index', methods: ['GET'] },
  { url: /\/css\/*/, methods: ['GET'] },
  { url: /\/js\/*/, methods: ['GET'] },
  { url: /\/images\/*/, methods: ['GET'] },
  { url: '/resetpassword', methods: ['GET'] },
  { url: '/api/resetpassword', methods: ['PUT'] }]} ));

Open in new window

Even though I can see the code gets executed for the getToken method, tied to the expressJwt object, and the return gets executed to return the access_token, I am still receiving the error indicating "No authorization token was found". Is there any additional plumbing required to integrate express-jwt and passport? Just to show the location.href is passing the url successfully, here is one of the url's: http://localhost:3000/testlist/1?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZmlyc3RuYW1lIjoiS2V2aW4iLCJsYXN0bmFtZSI6IlRheWxvciIsInJvbGVzIjoiYWRtaW4iLCJpYXQiOjE0ODg3NTM2OTIsImV4cCI6MTQ4OTM1ODQ5Mn0.4_XUXPAU13LtGRXqADuQpW0-jW2wErNlftjo4mttH7U, Plus I am seeing it in the getToken call. This is incredibly confusing. What could I be missing here? I follow this example to code the authentication, Any help would be greatly appreciated.
I'm looking for information on node.js. I am planning to implement an e-learning solution for a school system, and a partner suggested we use node.js as a platform, but since moodle is in php, and node.js is javascript, I'm confused. I have also never used this before, and don't understand what it is for.


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.

Related Topics