After deploying my node.js app to another PC (in the dev machine worked perfectly) and installing all the dependencies manually, I get this error when I try to execute it:
C:\Users\myself>node app.js
module.js:340
throw err;
^
Error: Cannot find module 'xmlhttprequest'
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> (c:\Keystroke\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\lib\transports\index.js:5:22)
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> (c:\Keystroke\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\lib\socket.js:5:18)
But if I run
npm ls -g
It returns the list of the globally installed modules, and it includes xmlhttprequest. Then why my app is unable to find it? What am I doing wrong?
The module probably needs to be locally installed for the project as well.
Do you have a package.json file? If so, run:
npm install --save xmlhttprequest
in your repo directory next time so when your switch machines, you can run npm install
to retrieve all of the dependencies.
Some dependencies are not useful when they are globally installed on the machine.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments