Node.js cannot find an installed module

Arcadio Garcia

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?

eddyjs

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Node.js: Cannot find module 'chai'

From Dev

Node js and phantomjs - Cannot find module 'weak'

From Dev

Node js and phantomjs - Cannot find module 'weak'

From Dev

cannot find node.js module

From Dev

Cannot find module './*.env' node js

From Dev

Module installed but Python cannot find it

From Dev

node js cannot be installed in ubuntu

From Java

Node.js Error: Cannot find module express

From Dev

Seriously debugging node.js 'Cannot find module xyz/abcd'

From Dev

Node.js Error: Cannot find module 'request'

From Dev

node.js cannot find a module in the same folder

From Dev

node.js Cannot find module './lib/compat'

From Dev

"Error: Cannot find module 'pkginfo'" - node js app deploying to heroku

From Dev

Cannot find module 'extend' Lambda node JS in AWS

From Dev

How to fix Node.js error: Cannot find module 'immer'

From Dev

Node.js - Error: Cannot find module 'config/chgpass'

From Dev

Seriously debugging node.js 'Cannot find module xyz/abcd'

From Dev

Error: Cannot find module 'html' with Node.JS and Express

From Dev

Node.js error: Cannot find module 'firebase/storage'

From Dev

Node.js Express Error: Cannot find module

From Dev

Node can't find installed mysql module

From Dev

Node.js - "Cannot find module", when the module call other module

From Dev

Node.js local-web-server: can't find module ws (installed globally)

From Dev

Node.JS cannot find module 'xml2js' (Windows)

From Dev

Node.js - Globally installed module showing 'MODULE_NOT_FOUND'

From Java

ERROR in Cannot find module 'node-sass'

From Dev

Heroku + Node: Cannot find module error

From Dev

Cannot find module 'node-gcm'

From Dev

Cannot find module 'node_modules/formidable'

Related Related

HotTag

Archive