Closed prasanthmpr closed 7 years ago
Can you include the full error message? It should indicate which line in graceful.js has the issue.
But ultimately what that error means is that on whatever line it references, there is something like "myvariable.prototype" and "myvariable" is undefined. You'll need to check further up in the code to ensure that "myvariable" is somehow defined first like "var myvariable = {};" or "var myvariable = function(){};".
For example, if I simply had:
//Start of script file
LKE.prototype.init = function(){
if(this.config.debug) console.log('Initializing Exchanger');
this.clients = {
ews:new EWS(this.config.ews.username, this.config.ews.password, this.config.ews.host,this.config.ews.options)
};
}
I would get the same error because "LKE" doesn't exist prior to me calling "LKE.prototype". The correct usage is:
//Start of script file
var EWS = require('node-ews'),
when = require('when'),
util = require('util'), //npm install util
_ = require('lodash');
//Declare "LKE" as a custom function.
var LKE = function(config){
this.config = config || {};
this.clients = {};
this.init();
}
//Here I'm expanding on "LKE" by defining an init function
LKE.prototype.init = function(){
if(this.config.debug) console.log('Initializing Exchanger');
this.clients = {
ews:new EWS(this.config.ews.username, this.config.ews.password, this.config.ews.host,this.config.ews.options)
};
}
For a good definition of using prototype vs declaring:
var myfunction = function(){
this.newfunction = function(){
...
}
}
Check out: https://stackoverflow.com/questions/310870/use-of-prototype-vs-this-in-javascript
var fs$ReadStream = fs.ReadStream ReadStream.prototype = Object.create(fs$ReadStream.prototype) ReadStream.prototype.open = ReadStream$open
var fs$WriteStream = fs.WriteStream WriteStream.prototype = Object.create(fs$WriteStream.prototype) WriteStream.prototype.open = WriteStream$open
/FS is not currently in use. So, i have used fs-extra instead of FS module. While i am changing var fs=require('fs') to var fs= require('fs-extra') i am getting this prototype error. /
What is the full error message?
After installing and including const EWS = require('node-ews') in my .ts file, i am getting this error
core.es5.js:1084 ERROR Error: Uncaught (in promise): TypeError: fs.readFileSync is not a function
TypeError: fs.readFileSync is not a function
at Object.
As FS is not currently in use, i have changed var fs = require('fs'); to var fs = require('fs-extra'); in WSSecurityCert.js. Then i am getting this error.
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'prototype' of undefined
TypeError: Cannot read property 'prototype' of undefined
at patch (graceful-fs.js:166)
at Object.
That seems to be a graceful-fs or fs-extra issue. I suggest you take a look at this thread (https://github.com/jprichardson/node-fs-extra/issues/261).
Just realized that this is part of #59 whereby I can see that this is for an Ionic project. As this is not a node-ews issue I'm going to close this thread. A link to a possible solution was posted on the other thread which I will leave open for further discussion.
After installing and including the node-ews in my ionic project, getting the error as " TypeError: Cannot read property 'prototype' of undefined" in graceful.js.
Anyone have come across this issue?