2018-10-22         Norton

Installing homebrew AFTER I already installed node git and gulp -will this cause problems?

If I installed node/gulp and git do I even need to use homebrew -if so what are the benefits?What would happen IF I did?Would I have multiple versions of node/gulp/git floating around on my machine?Ideally should I uninstall them in order to manage them with homebrewI'm just learning so I can get react running In your case, it's better to uninstall the manually installed versions of node, gulp and git and to reinstall them through homebrew.You can then upgrade them all in one command with:brew upgradeand uninstall them cleanly and easily with e.g.:brew remove nodeThe mai...

 node.js                     1 answers                     94 view
 2018-10-22         Kristin

VSTS with gulp v.4.0.0

I'm having the gulp version of one of my projects. Previously we were using version 3.9.1 and we were hestitative updating.After updating i have fixed all local issues and tested the project on a different computer (after updating the installed gulp there as well) it works fine.Our automatic deployment however won't agree with me.After a check-in our VSTS does the following stepsinstall npmexecute commandbuild projectHowever, this produces the following error.Working directory changed to D:\a\1\s\MVCUsing gulpfile D:\a\1\s\MVC\gulpfile.jsC:\NPM\Modules\node_modules\gulp\bin...

 node.js                     2 answers                     95 view
 2018-10-22         Belinda

How do I run a simple file script from using yarn in windows

I'm new to the whole Node.js world but this probably simple problem is driving me nuts. It's basically a simplified version of a problem I'm having with a bigger project.File structurepackage.jsontest1My package.json looks like so:{ "name": "Temp", "version": "1.0.0", "main": "index.js", "license": "MIT", "scripts": { "testscript": "test1", "testrun":"yarn testscript" }}test1 just contains a simple console.log('test') command.Now when I do yarn testrun I get the following error:PS C:\dev\temp> yarn testrunyarn run v1.9.4$ yarn testscript$ test1'test1' is not ...

 node.js                     1 answers                     30 view
 2018-10-22         Monroe

CORS Error when fetching data from Zoho API on React frontend

The company I work at makes use of Biometric attendance, and syncs the data up to Zoho servers for record keeping. I tried to develop a web-app making use of the Zoho People API, which lets me know when I checked in and when my 8.5 hours will be up.I used Create-React-App to develop the same.Now, the API calls work properly in the node server, where I am able to log the data, but when I start a local server using npm start, Chrome is not able to show the data and I get the following error: Failed to load https://people.zoho.com/people/api/attendance/getAttendanceEntries?aut...

 node.js                     1 answers                     36 view
 2018-10-22         Quintion

Set node environment variable to dynamic value in npm script

I would like to set an environment variable dynamically in an npm script. I'm using cross-env as I'm developing on Windows and the server is Unix-based. I want to initialize an environment variable with the current date (new Date()) so I can access and render it in my create-react-app:This works (hard-coded string):"scripts": { "start": "cross-env-shell REACT_APP_BUILD_DATE=\"currentDate\" react-scripts-ts start",}Obviously, currentDate shouldn't be a string but the result of following expression: new Date().How can I achieve that? In other words: How can evaluate some reg...

 node.js                     3 answers                     36 view
 2018-10-22         Emma

Could not install create-react-app through npm

I used the following code to install create-react-appnpm install -g create-react-appi am getting error 500:npm ERR! code E500npm ERR! 500 Internal Server Error: create-react-app@latestfull error log:0 info it worked if it ends with ok1 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 'install',1 verbose cli 'create-react-app' ]2 info using npm@6.2.03 info using node@v10.9.04 verbose npm-session 6a3b73048c5092075 silly install loadCurrentTree6 silly install readLocalPackageDa...

 node.js                     1 answers                     38 view
 2018-10-22         Wilbur

send token to server in angular universal

I have an Angular 6+ app which is configured to utilize server side rendering using Angular Universal.I also used TransferState to avoid duplicate API calls on the server and client app.Authentication in my angular app is based on token.The problem is in the first time the user opens my web app, which results to rendering index.html for a user which is not authenticated whereas the user actually is logged in but there is no opportunity to transfer the token to the server. So, when the client app swapped with server app, it is required to call APIs again because of the exist...

 node.js                     1 answers                     60 view
 2018-10-22         Nicola

Error in updating form values in mongoDB using nodejs

Post Delete options are working fine but the put is not working it updates successfully but with function String() { [native code] } values.controller.tsrouter.put('/:id', (req,res)=> { if (!ObjectId.isValid(req.params.id)) { return res.status(400).send('No record with the given Id ${req.params.id}'); } var emp = { email: String, name : String , position : String , office : String, // salary : Number }; Employee.findByIdAndUpdate(req.params.id, { $set : emp },(err,docs) => { if (!err) { res.se...

 node.js                     1 answers                     85 view
 2018-10-22         Earl

Can't push/update data into existing mongo object

I have a user object which consists of a couple of arrays inside it, which looks like this:{_id: "5b90a261ff3712000495ca29", name: "Udit", email: "guru.udit@bmail.com", password: "sjsndj", education:[], professionalexp:[], projects:[], skills:[]}I am using express API to push data into education array with some object, the following is the code I am trying to update mongo data. When I try to push and update data I see no response. How should I go about and push array or multiple arrays at onceapp.put('/api/updatefield/',function (req, res){ User.update({_id: ...

 node.js                     1 answers                     89 view
 2018-10-22         Yvette

errorCastError: Cast to ObjectId failed for value "comment" at path "comments"

When i submit the form i keep getting this (errorCastError: Cast to ObjectId failed for value "comment" at path "comments") i hope you got my question rightThis is the form reqaction="/campground/<%= camp._id %>/comments/" method="POST">and this the route that rendering the form pageapp.get("/campground/:id/comments/new", function(req, res){ Campground.findById(req.params.id, function(err, camp){ if(err){ console.log(err); } else { res.render("comments/new", {camp: camp}); } });});This the post route that creating ...

 node.js                     1 answers                     92 view
 2018-10-22         Sidney

Add header to all responses after processing but before sending to client

I have two endpoints in a node js app:app.get('search', myGetController);app.post('add', myPostController);For simplicity, let's assume both services have only the following code:exports.myGetController = function(req, res) { res.status(404).json({ error: "not found" });};I want to have a middleware that is executed after the processing of the controllers, but before they are sent to the browser, so I can add a header based on the body of the response.// process all responses to add ed25519app.use(function(req, res, next) { res.setHeader('CharCount', [How To get Body ...

 node.js                     1 answers                     92 view
 2018-10-22         Duke

How to understand node-soap "describe" function?

I'm attempting to use the node SOAP npm module(https://github.com/vpulim/node-soap) service. var soap = require('soap');var soapWSDL = "https://webservice.s7.exacttarget.com/etframework.wsdl";soap.createClient(soapWSDL, function (err, client) { if (err) { return callback(err, null); } client.setSecurity(new soap.WSSecurity(self.username, self.password)); console.log("describe", client.describe()); console.log("retrieve", client.describe().PartnerAPI.Soap.Retrieve);});The first log shows the available methods... But i'm trying to understand the exact for...

 node.js                     2 answers                     51 view
 2018-10-22         Wendy

Error "TypeError: Cannot read property 'seconds' of null" when commit Firestore batch

I got the following error when trying to batch delete a collection: TypeError: Cannot read property 'seconds' of null at Function.fromProto (..\node_modules\@google-cloud\firestore\build\src\timestamp.js:91:47)The code is plain simple (written in TypeScript):var admin = require('firebase-admin');...var batch: FirebaseFirestore.WriteBatch = admin.firestore().batch();return generic.application.admin.firestore().collection(name) .get() .then((docs: FirebaseFirestore.QuerySnapshot) => { docs.docs.forEach((doc:any) => { batch.delete(doc.ref); ...

 node.js                     1 answers                     76 view
 2018-10-22         Jo

Axios calls not working with localhost in production

My title states my problem, but I'm actually looking for a best practice. In the case of my current project I'm using a vue.js app to call out to a nodejs server I have running on the same box. In development I just hardcoded http://localhost/api/etc.... into my axios calls and figured since I was deploying both in production to live on the same box too, that would be fine, but once I deployed I started getting 404s for the axios calls. I had to refactor my code to use the actual dns name of the server.It works now because of that, but I feel like I'm missing something. I'm...

 node.js                     1 answers                     79 view
 2018-10-22         Porter

readFileSync returns no data even though file exists

tl;drreadFileSync returns a zero sized result after reading a file that is ~24kb. No errors are thrown.The not so tl;drTo start of, I use browserify programatically to build three JS files. This completes successfully, the files are present at the location I expected, file names are what I expect, manually checking the file size and contents all is as expected.A little later during code execution I use readFileSync to read these files back in, and concatenate them with other files to create bundles. Problem is, for one of the three generated files, all is good, but for the ...

 node.js                     1 answers                     80 view
 2018-10-22         Marvin

LoopBack Saving find result to a variable

I'm trying to save find results to a variable, I looked around and couldn't find any clear answer, here is what i want to do:var data; myModel.findOne({ where: { Key: 'myKey' } }, function(err, model) { if (err) { console.log(err); } data = model; });I looked at this similar question but didn't find an answer. // Here you create a new variable called datavar data;myModel.findOne({ where: { Key: 'myKey' }}, function(err, model) { // You create a new variable called ...

 node.js                     1 answers                     77 view

Page 1 of 1320  |  Show More Pages:  Top Prev Next Last