I am a newbie with nodejs.
I installed globally modules zepto and jsdom :
npm install jsdom -g
npm install zepto -g
I checked with npm list -g
. These modules are installed.
But when I reference these two modules in a script using require:
var jsdom = require("jsdom");
var Zepto = require("zepto");
I got an error message :
Error: Cannot find module 'zepto'
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 Object.<anonymous> (/home/user554/dev/exchange/bin/getExchangeData.js:6:13)
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)
at Function.Module.runMain (module.js:497:10)
I tried with only jsdom and only zepto. Only Zepto fails.
What am I missing ? Thank you for your help.
The zepto
package is not a proper Node package. It installs a minified version of the Zepto lib, but it looks like it's meant for browser usage (why would it be in the NPM repository? I have no idea).
Instead, try the zepto-node
package.