Node.JS cannot find module 'xml2js' (Windows)
I was also facing the same issue. Here's what I did:
Install the module using following:
$ npm install -g *module_name*
Then go to any parent dir of your project dir (it can be project dir itself) and run the following command:
$ npm link *module_name*
Make sure that the directory ./node_modules/xml2js
exists.
When you run npm install somemodule
at D:/test
, it will be stored to D:/test/node_modules/somemodule
, then you can require this module in D:/test/*.js
, and you can not require it at D:/other/place/*.js
. If you hope the module can be required anywhere you should run:
npm install somemodule -g