cordova-plugin-googlemaps: Error: Cannot find module '../node_modules/xml2js'

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

About this issue

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

Commits related to this issue

Most upvoted comments

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

+1 Same problem here.