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

hey ,
when i trying remove any plugin it’s give me this error

(node:42689) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../node_modules/xml2js'
(node:42689) [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.

my ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2


    ios-deploy : 1.9.2 
    ios-sim    : 6.1.2 
    Node       : v8.4.0
    npm        : 4.2.0 
    OS         : macOS Sierra
    Xcode      : Xcode 9.2 Build version 9C40b 

my plugin list

com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
cordova-plugin-accountkit 1.4.0 "Cordova AccountKit"
cordova-plugin-camera 4.0.2 "Camera"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.2.8 "cordova-plugin-googlemaps"
cordova-plugin-googleplus 5.2.1 "Google SignIn"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova.plugins.diagnostic 4.0.3 "Diagnostic"
ionic-plugin-deeplinks 1.0.15 "Ionic Deeplink Plugin"
mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"
onesignal-cordova-plugin 2.3.2 "OneSignal Push Notifications"

help please ,
thanks in advance

1 Like

i think the error is related to cordova-plugin-googlemaps the before_plugin_rm.js located in plugins/cordova-plugin-googlemaps/src/before_plugin_rm.js required the xml2js with a wrong path , so replace the
line : var xml2js = require('../node_modules/xml2js'); with this line
var xml2js = require('../../../node_modules/xml2js');


Please make sure to report this problem and its solution to the plugin author so it can be fixed for all users of the plugin. Thanks.

i’m already did this , i have made an issue 2158 in cordova-plugin-googlemaps and waiting for cordova-plugin-googlemaps team response ,

1 Like