Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

Node.js

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

How  can  I   run  NPM  commands behind a company  corporate proxy server?I tried to google online with no  success.
npm config set proxy http://xxx.cc.zz:8080
npm config set https-proxy http://xxx.cc.zz:8080
0
Threat Trends for MSPs to Watch
Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

I've created a custom API for internal use and have query strings used to find specific assets - http://localhost:3000/api/asset?ipaddress=10.1.1.100 ... returns 1 device

What I would like to do is return results for all devices with the ip address that contains the substring in the query string - http://localhost:3000/api/asset?ipaddress=10.1.1 ... returns all devices within this subnet. Right now, this returns 0 devices.

Here's the structure of my router(s) -

router.get('/', verifyToken, function (req, res) {
    const query = {};

    if(req.query.clientcode)
        query.clientcode = req.query.clientcode;
    if(req.query.assetkey)
        query.assetkey = req.query.assetkey;
    if(req.query.name)
        query.name = req.query.name;
    if(req.query.siteid)
        query.siteid = req.query.siteid;
    if(req.query.ipaddress)
        query.ipaddress = req.query.ipaddress;

    asset.find(query,function(err, results) {
        return res.json(results);
      });
});

Open in new window

0
I found a health alert on our small S2D cluster saying there was not enough reserve capacity on the Cluster.  We have a two node storage spaces direct cluster with 4 1.6TB SSD's per server for a total of  about 11gigs total when I set up the cluster for mirrored pool there was only about 6gig usable which I split between the two servers I have two 2.7gig CSV's one has 915GB free the other has 1.95TB free. Does anyone know what I am missing here?

S2D1.JPGS2D2.JPGS2D3.JPG
S2D4.JPGS2D5.JPG
0
Hi

can someone know how to configure DAG on 3 exchange server that work on node majority method ?
the configuration look very simple but is`t request from me  to enter witness server   and  i know that in node majority method
the witness server is not necessary .
there is any way to bypass this request and create the DAG without witness server ?
and if i create it with witness server on node majority method  which data will be save/create  on the witness server
and were i should create the witness  is this situation?
0
Hi experts,

I'm did the basic angular example at this link.
https://angular.io/guide/quickstart

So I installed node 8.9.3  and npm.

In my windows 10 command prompt after i installed node and npm...

if I type the following
>node --version

I get this: v8.9.3

if I type the following
>npm --version

I get this 5.5.1

So then using angular cli I created the angular example from the link above.

After I created the example in the link above, my directory looks like this:

Capture.PNG
So when I serve the project using this command

>ng serve --open

The app runs fine and looks like this when the browser launches

app run

After I ran the app, then in the command prompt I typed in this command to see the angular CLI version:

> ng --version

When I run that command I get this:

version

So I'm assuming the sample project I just created above is an Angular 5.1.2 project.

When creating the project with Angular CLI,
is there a command that lets you input whether you want to create an Angular 2 project or Angular 4 project or Angular 5 project?
0
Hi Guys

On an Exchange 2013 solution with 1 node i have a small problem.

User A can send a mail directly to user B without a problem. Mailflow is fine.  

If user A then sends an email to a distributions list where user B is a member the email will not reach user B but the email reached other mailbox users just fine. User A confirms autocompletet is not used when sending the email.

The error information is as follows

IMCEAEX-_o=First+20Organization_ou=Exchange+20Administrative+20Group+20+28FYDIBOHF23SPDLT+29_cn=Recipients_cn=user252852dd@senderdomain.dk Remote Server returned '550 5.1.1 RESOLVER.ADR.ExRecipNotFound; not found'
0
I am a beginner to react. While setting up the installation and loading up all the dependencies, I finally run the
 npm start

Open in new window

command but this generates the error ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in 'C:\Users\me\Documents\React\react-playlist' I have performed all the installation steps correctly. I have also attached the screenshot of the project folder. I also got webpack installed globally v 3.10.0 but that also didn't work. I also tried by inserting resolve loaders code in package.json file but that also didn't work. Here is the error picture.

P.S.: I'm following this tutorial

Below is the code of my project.

Package.json file:

{
  "name": "react-playlist",
  "version": "1.0.0",
  "description": "All the course files for the Net Ninja React tutorial playlist on YouTube",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run build",
    "build": "webpack -d && webpack-dev-server --content-base src/ --inline --hot --port 1234"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/iamshaunjp/react-playlist.git"
  },
  "author": "me",
  "license": "MIT",
  "bugs": {
    "url": 

Open in new window

0
Hello

I would like to learn React Native and I have seen various tutorials including this one

 (https://facebook.github.io/react-native/docs/getting-started.html).

There are 2 guides: the quick start and the building projects with native code. The quick start uses Create React Native App  and the other one requires you to install all the dependencies: Node, the React Native command line interface, Python2, a JDK, and Android Studio.

Would you advise the  Create React Native App as a quick way to get started or is it better to do the full set up? I have not used react native so I am guessing if I want a quick intro to it I could use  Create React Native App and then if I find I use it then do the full set up? I'm also wondering  if I use Create React Native App as a quick way to get started will I learn unhelpful idiosyncrasies of that tool that I will need to unlearn or is it better to start with the 'full' set up.

The link to get Create React Native App is https://github.com/react-community/create-react-native-app and I have been advised in another question to use https://github.com/nodesource/distributions for Node

I dont have a specific use in mind for react native but it is a technology that seems to be growing that I know nothing about so I would like to find out a bit about it. I have been told it is 'the future' for phone apps. I write games in javascript that run in web pages on a pc but would like to move to games on phones and tablets with …
0
Hello

I am learning node and the node package manager. I understand the npm is to install libraries and packages etc. I understand node.js runtime is what will execute the javascript code but in the tutorial I am following it says to do this

npm install -g npm

This is installing the npm package according to the guide. What is the npm package?

Ive read these pages:
https://www.npmjs.com/
https://www.npmjs.com/package/npm

The first page gives common packages which people install, one of which is npm, a javascript package manager

I thought i had already installed the node package manager with node? Please can you explain the difference between the npm command line tool and the npm package you install with it?

Many thanks
0
Hello
am facing some issue with exchange DAG cluster node one node cluster services not starting..
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I am developing an app with Electron and need to display a message box to the user. This is the code I have:

const   electron = require('electron')
const   dialog = electron.dialog

        dialog.showMessageBox(BrowserWindow, {
            type: "info",
            buttons: ["OK", "Cancel"],
            title: "Importer Finished",
            message: "All done",
            detail: "Open you imported project in the IDE"
        }, resp => {

        })

Open in new window


The message box displayed does not follow the options, see the attached snippet.

I hope someone can point me in the right direction to fix this, thanks,
Sid
a-1.PNG
0
Over the last few weeks I have been building and testing a two node S2D cluster I am just about finished with it but I have a question about CSV disk ownership when you run the VM fleet each node is assigned a CSV for the VMFleet storage if you reboot a node that nodes CSV moves ownership to the other node when the VM Fleet is run again the node with all the disk ownership runs at a higher load then other.  My question is two fold the CSV ownership does not move back when I unpause the node is this correct will I have to move the disk manually back to the correct owner every reboot? Second part is the assignment of the CSV previously I only had one due to the storage being provided by a 3rd server to the two nodes.  So If I want the best performance I should evenly split the storage and give each node a CSV and just put half of the VM's on one disk and the other half on the second CSV?
0
Hi everyone,
Does anyone know how to preserve snapshot tags in AWS. This node.js function moves the snapshots to another region but does not preserve tags so it becomes difficult to identify which server the snapshot belonged to.
If I cannot preserve tags, I would like to know how to tag a snapshot using the javascript code below. Example Key:DeleteOn Value [currentdate]
I found this code snippet that may be of help:
http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/ec2-example-creating-an-instance.html

 // Add tags to the instance
   params = {Resources: [instanceId], Tags: [
      {
         Key: 'DeleteOn',
         Value: 'current date as 2017-12-05'
      }
   ]};
   ec2.createTags(params, function(err) {
      console.log("Tagging instance", err ? "failure" : "success");
   });
Thanks!
Peter
//define variables
var sourceRegion = 'us-east-1';
var destinationRegion = 'us-east-2';
var AWS = require('aws-sdk');
console.log ('Loading function');

//main function
exports.handler = (event, context, callback) => {

    //Get the EBS snapshot ID from Cloudwatch event details
    var snapshotArn = event.detail.snapshot_id.split('/');
    const snapshotId = snapshotArn['1'];
    const description = 'Snapshot copy from ${snapshotId} in ${sourceRegion}';
    console.log ("snapshotId:", snapshotId);

    //Load EC2 class and update the configuration to use destination
    AWS.config.update({region: destinationRegion});
    var ec2 = new 

Open in new window

0
Hello Everyone

I am a recently converted vb.net developer taking a Full Stack Web developer Boot Camp.  It is moving very fast and we are seeing quite a bit of information/technologies.  I am having a bit of trouble where they all fit together in the diagram.  

First we did HTML/CSS. Then added javascript.  Then moved the javascript to server side.  Then Node, Express, Sequelize. ORM, MVC, React/Yarn, Firebase, Mysql, Mongo.

Is there any kind of diagram that could help me understand how all of this relates together?

Thanks,
jimbo99999
0
If you look at the Orography tab in the attached file there is a graph. The blue line represents a hill or ridge. The dots represent the position of a scaffold on the hill. On the left is the upwind side and there is an orange line. If the scaffold is above this line then it is affected by the terrain and a set of equations need to be checked. I want to shade above the line. On the right is the downwind side. I want to shade below the grey line down to blue. I can introduce dummy nodes to place a node on the blue line directly under the grey line node. I can do the same the other side at 0,900. I cannot find how to shade these areas?
graph.xlsx
0
Angular: 5.0.1 / Angular CLI: 1.5.0 / Node: 8.9.1 / npm: 5.5.1 / Os: win32 x64

I get the below error when executing "npm start" in the terminal/command prompt. Can anyone help me resolve this? I have spent a whole day trying to fix it with no luck.

Here is the scripts section of my package.json

"scripts": {
    "start": "webpack-dev-server --inline --progress --port 8080"
  },

Here is the error

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli
'start' ] 2 info using npm@5.5.1 3 info using node@v8.9.1 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle angular-io-example@1.0.0~prestart: angular-io-example@1.0.0 6 info lifecycle angular-io-example@1.0.0~start: angular-io-example@1.0.0 7 verbose lifecycle angular-io-example@1.0.0~start: unsafe-perm in lifecycle true 8 verbose lifecycle angular-io-example@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\cbonsu\Downloads\sample_pro\webpack\node_modules.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program …
0
Hi, I' need to select a specific node in an xml doc... i have this which gives me everything

For Each xmlNode In objXML.documentElement.selectNodes("Data")

but i need a single node and its related nodes that has a specific value.. please see the xml

for example: I need to select only the Data where Bookcode = NEA-CSOP

Thank you

<DocumentElement>
<Data>
  <BookCode>NEA-CSOP</BookCode>
  <BPSday>3</BPSday>
  <BPSwk>6</BPSwk>
  <BPSmth>8</BPSmth>
  <Trackday>-44.6</Trackday>
  <TrackPnL>0</TrackPnL>
  <WAIVImv>0.239</WAIVImv>
  <WAIVexp>0.252</WAIVexp>
  <x90Day>0.256</x90Day>
</Data>

<Data>
<BookCode>NEA-EA1</BookCode>
<BPSday>18</BPSday>
<BPSwk>39</BPSwk>
<BPSmth>44</BPSmth>
<Trackday>-23.5</Trackday>
<TrackPnL>0</TrackPnL>
<WAIVImv>0.219</WAIVImv>
<WAIVexp>0.217</WAIVexp>
<x90Day>0.256</x90Day>
</Data>

<Data>
<BookCode>NEK-MV4</BookCode>
<BPSday></BPSday>
<BPSwk></BPSwk>
<BPSmth></BPSmth>
<Trackday></Trackday>
<TrackPnL></TrackPnL>
<WAIVImv></WAIVImv>
<WAIVexp></WAIVexp>
<x90Day></x90Day>
</Data>
<DocumentElement>

Open in new window

0
As a C# developer, I am used to NHibernate and Entity Framework. What can a Node developer use to bring ORM functionality to Node?

In the past, with Node, I have only used SQL command embedded into the code, then executed. I'm am sure, even then, this was a worst practice.

What is the best practice way, using Node.js, to make use of an ORM?

(I am not sure if I am ready for a JSON database like MongoDB unless it helps you answer this question)

Thanks
0
I am trying to install the following for a new application:
Angular5
Bootstrap4
Firebase and Firestore
Firebase Hosting (probably)
Firebase Auth

I can get everything installed but there are dependency issues.  I think Node.js 9.0.0 does not work with NPM 5.5.1 and the Angular/cli.  Node.js 9 comes with NPM 5.5.1 so I'm not sure what the problem is.  I tried to update my package.json file with v. 5.5.1 from 5.0.0 but that causes even more issues.  I know this is all new but has anyone found a way to work around it?  Different versions?
0
Veeam and MySQL: How to Perform Backup & Recovery
LVL 1
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

I suddenly need to buy a new PC and have been doing Angular work on a MacBook.

It seems Windows PC are mainly  Windows 10.

What version of windows is needed to install Node? Angular? SQ Server and Visual Studio?

Thanks
0
guys, here is the question. I have one function that optimize images using jimp package and I want to run this function on the command line of one server on digitalocean but i dont want to install lots of things on it. so I install npm and node, but I am very new to node and npm, so I dont know how to execute this javascript that will read the files and optimize images. I want to be able to do something like this on terminal:   execute optimize.js /var/www/html


here is the function I did:

function optimize(path){
    let Jimp     = require("jimp");
    let fs = Npm.require( 'fs' ),
    try { var files = fs.readdirSync(path); }
    catch(e) { console.log(e); }
    if (files.length > 0){
      for (var i = 0; i < files.length; i++) {
          //console.log(files[i]);
          var originalPath = path + '/original/' + files[i];
          var currentPath  = path + '/' + files[i];
          //copy img code here
          console.log('Processing 1. Copying bkp to folder: '+originalPath);
          fs.copyFileSync(currentPath, originalPath);
          //remove current file code here
          console.log('Processing 2. Removing current file from folder: '+currentPath);
          fs.unlinkSync(currentPath);
          //optimize image.
          Jimp.read(originalPath, function (err, lenna) {
                  console.log('Processing 3. Starting Optimizing from: '+originalPath);
                  console.log('Processing 4. Starting Optimizing to:   …
0
Created a duplicate username entry in mongoose database and resulted in duplicated error. Now everytime I start server, I get this error:

(node:14839) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CastError: Cast to ObjectId failed for value "{ type: 'Buffer',
  data: [ 89, 243, 30, 231, 66, 69, 45, 56, 123, 65, 153, 72 ] }" at path "_id" for model "users"
(node:14839) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
0
Python Gurus,

I have an outer loop where I pull node information off the network, within that loop I pull the device information, within that loop, I pull the connected device info. Mostly I cycle through this loop without errors, however, lately I've been getting the error "string indices must be integers". The failure is happening in the last inner loop (clients). Since this just started happening, I'll have to assume new data came through that I haven't accommodated.  I would like to write this in such a way that I accomplish 2 things: 1.) Identify which element is the culprit; 2.) when there's an error, it is noted (logged), then on to the next, without an exit.

       
  
       try:

            [snippet begin]
         
             clients_json = clients_response.json()
  
              for clientEntry in clients_json:
                    mdnsName = clientEntry['mdnsName']
                    deviceDesc = clientEntry['description']
                    dhcpHostName = clientEntry['dhcpHostname']
                    clientMac          = clientEntry['mac']
                    Id          = clientEntry['id']
                    Ip          = clientEntry['ip']
                    usageRecv     = clientEntry['usage']['recv']
                    usageSent         = clientEntry['usage']['sent']
                    #TODO: Get this is UTC format
                    InsertDate = '10/24/2017' 

      
                pass

               [snippet ends]

        except 

Open in new window

0
I want to make it easy to run my Angular app so it's easier to show the problem I am having. But I just noticed the repo contains tons of node packages, brining the size of this little Angular program (with two Components) to 172 MB.

I did not want to commit and push this without asking how Plunker works and what options I have regarding all those node modules.

Thanks.
0
I have a bunch of complicated node apis deployed on ec2s. What would be the easiest way to make them lambda compliant (by adding handler method) and deploy them on lambda ?
I am looking for some steps and guidance.
Thanks
0

Node.js

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
Node.js
<
Monthly
>