Module version mismatch. Expected 11, got 1
you might give the error like this:
Error: Module version mismatch. Expected 11, got 1.
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> (/home/user/node_modules/xml2json/node_modules/node-expat/lib/node-expat.js:4: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 Module.require (module.js:364:17)
and then, you can notice the error in module or somewhere.
this is because you have updated your node, you might rebuild the module found above.
i revole my question by reinstall(remove, then install) xml2json.
good luck!
npm rebuild will also do the trick
https://www.npmjs.org/doc/cli/npm-rebuild.html
Platform: Linux
For future reference in node.js v0.10.x
(at least v0.10.0) I got this error:
Error: Module version mismatch. Expected 11, got 1.
To fix this I found this interesting link and also had some help from Ben Noordhuis. The following command helped me get rid of this error:
npm update
This usually happens when you install a package using one version of Node, then change to a different version. This can happen when you update Node, or switch to a different version with nvm.
It can also happen if you're trying to run a process as root with a globally installed Node, but you're running an nvm-managed node within your own user account.
To fix this, you can simply re-install the packages using the correct version of Node. Also ensure that you're using the same version of Node across the different users.
This problem is happened because following scenario: you are using Node for example version 5. You add some libraries inside your project, build and run that. All your libraries will be compiled under node version 5.
And then you upgrade your node for example to version 6. And then you run some commands that using node, for example npm run test
. The problem is here: you use newer node version for running libraries that compiled by older node.
Solving this is easy by 2 following commands:
rm -rf node_modules // force remove node_modules directory
npm install // install again all libraries.