0

I am currently learning node and pulled a git project. When I am trying to run the main javascript file with the command node main.js, it is throwing the below error:

module.js:340
    throw err;
    ^
Error: Cannot find module 'libxml-xsd'
    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> (/Users/me/project/controller/product.js:12:11)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/me/project/main.js:44:15)
    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)

I tried to run 'npm install libxml-xsd', but was not successful. When I did npm list it says UNMET DEPENDENCY libxml-xsd@^0.2.0 and below is the stacktrace:

npm ERR! missing: libxml-xsd@^0.2.0, required by me@0.0.0
npm ERR! extraneous: libxmljs@0.15.0 /Users/me/project/node_modules/libxmljs
npm ERR! extraneous: libxmljs-easy@0.2.1 /Users/me/project/node_modules/libxmljs-easy

NOTE: I already ran npm install libxmljs, npm install libxmljs-easy and using Mac OS X 10.11. Node version - v0.10.36 and npm version - 2.14.7

EDIT: Using libxmljs directly also didn't fix the problem (as suggested by one user below)

ani0710
  • 266
  • 4
  • 20
  • Possible duplicate of [Validating XML against a schema (xsd) in NodeJS](http://stackoverflow.com/questions/14856643/validating-xml-against-a-schema-xsd-in-nodejs) – Juicy Scripter Oct 28 '15 at 13:13
  • `libxml-xsd@0.2.0` using outdated `libxmljs` version, you may try to use [`libxmljs`](https://github.com/polotek/libxmljs) directly – Juicy Scripter Oct 28 '15 at 13:15
  • Using libxml directly didn't fix this problem @JuicyScripter – ani0710 Oct 28 '15 at 18:09
  • Do you have packages in your package.json defined which rely on a different version of libxml-xsd? – Rik Oct 28 '15 at 18:17
  • @Rik: yes. it is defined as "libxml-xsd": "^0.2.0" – ani0710 Oct 28 '15 at 20:05
  • Sorry for the confusion. I meant, are there multiple packages your application depends on (in the dependencies section of your package.json) that also require this package, but a different version. Because in that case 'npm install' will not install it, because it doesn't know what version to install. If you delete your node_modules and rerun npm install, what errors does it throw? – Rik Oct 28 '15 at 20:09
  • This is the error: **npm ERR! libxmljs@0.11.1 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the libxmljs@0.11.1 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the libxmljs package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls libxmljs** – ani0710 Oct 29 '15 at 06:32

0 Answers0