Unable to load node.js package
I have a node.js project where I'm trying to load and parse .xml files. In an attempt to do this, I was going to rely on the DOM Parser via the following command:
npm install xmldom
The package was successfully installed. However, when I attempt to execute my Code via mocha, I get an error that says: "Error: Cannot find module 'xmldom'". My code works fine until I add the following line at the top of my code:
var dom = require('xmldom');
If I comment out the line, my code works. But, if I remove the commments, to make the code active, I get the error again. I haven't written anything to actually parse the xml file yet. I'm just trying to import the dom parser at this point.
I also tried loading the xmldom package globally with the following command:
npm install -g xmldom
That did not solve my problem either. What am I missing?
I wrote a blog post explaining what to look for when you get a Cannot find module 'xmldom' error.