I have problem when trying to run my application, running on NWJS. When looking in the NWJS devtools console, I get the error Uncaught error: Cannot find module './lib/helpers/'
. On the end of the line (in the console) I see a VM
with a 3 digit code, followed by a line number. When clicking on it, I get the following JS:
(function() {
// detect `nw` object of NW13
if (!(self.nw && self.nw.require)) return;
var realrequire = nw.require;
self.require = function() {
if (arguments[0] === 'nw.gui') {
return nw;
} else {
return realrequire.apply(self, [].slice.call(arguments, 0));
}
};
self.require.cache = realrequire.cache;
self.require.extensions = realrequire.extensions;
self.require.resolve = realrequire.resolve;
// Following items exist when running with `--mixed-context`.
// Copy them from `nw` to browser context
if (!self.process) self.process = self.nw.process;
if (!self.Buffer) self.Buffer = self.nw.Buffer;
if (!self.global) self.global = self.nw.global;
}());
I already found out that the above code is in the resources.pak file included in the NWJS folder.
And the strange part is that on the development pc this works fine, but when I git clone this on a test pc, I get the previous mentioned error. Have checked the versions of the npm packages with the npm list --depth=0
command, but both versions of dev pc and test pc seems to be the same.
From here the trail ends. I have no idea where to start looking from here. Hope anyone can help me.
I use:
I found the solution, I needed to downgrade npm request package to 2.8.7 make it work.