question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module '../node_modules/xml2js'

See original GitHub issue

hey i’m using ionic wrapper , and when i try to remove any plugin from my project it’s give me this error

node:43267) UnhandledPromiseRejectionWarning: Error: Cannot find module '../node_modules/xml2js'
    at Function.Module._resolveFilename (module.js:543:15)
    at Function.Module._load (module.js:470:25)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
    at module.exports (/Volumes/Partion/App/Projects/TucTop Application/TucTopFinal/plugins/cordova-plugin-googlemaps/src/before_plugin_rm.js:7:16)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:18)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:164:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:132:20
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
(node:43267) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:43267) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

when i’m go to mention file src/before_plugin_rm.js i found that the require function get a wrong path for xml2js

var xml2js = require('../node_modules/xml2js');

when i correct the path from above line to this

var xml2js = require('../../../node_modules/xml2js');

the problem solved successfully

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

13reactions
YousefRabieKhalilcommented, Mar 19, 2018

i mentioned the solution above in plugins/cordova-plugin-googlemaps/src/before_plugin_rm.js replace var xml2js = require('../node_modules/xml2js'); with var xml2js = require('../../../node_modules/xml2js'); will solve the problem

3reactions
saurabh-dkcommented, Mar 19, 2018

+1 Same problem here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.JS cannot find module 'xml2js' (Windows) - Stack Overflow
node_modules/xml2js exists. When you run npm install somemodule at D:/test , it will be stored to D:/test/node_modules/somemodule , then you ...
Read more >
xml2js - npm
Simplest way to install xml2js is to use npm, just npm install xml2js which will download xml2js and all dependencies.
Read more >
Failed to install 'cordova-plugin-firebasex': Error: Cannot find ...
when i ran cordova platform add ios get the error : Failed to install 'cordova-plugin-firebasex': Error: Cannot find module 'xml2js'.
Read more >
Ionic Forum - Ionic Framework
Error : Cannot find module '../node_modules/xml2js' · Ionic Framework ionic-v3.
Read more >
Node.js cannot find module xml2js - iTecNote
nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'xml2js', in paths: /root/.node_modules,/root/.node_libraries,/usr/local/lib/node ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found