Search code examples
node.jscordovanpmcordova-pluginsnode-modules

Cordova globalThis is not defined error after updation cordova to 10.0.0


Hi I have developed a cordova app using cordova version 8.1.0 but when i went to upload it , play store gave error that my app targets API LEVEL 28 and i need to upload app which target API level 29 atleast, I then update cordova to 10.0.0 after that I cant build app neither can do anything its throwing globalThis not defined even if i try to check cordova -version. npm version i have is 3.10.10

    Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\karan>cordova -version
C:\Users\karan\AppData\Roaming\npm\node_modules\cordova\node_modules\queue-micro
task\index.js:5
  ? queueMicrotask.bind(globalThis)
                        ^

ReferenceError: globalThis is not defined
    at Object.<anonymous> (C:\Users\karan\AppData\Roaming\npm\node_modules\cordo
va\node_modules\queue-microtask\index.js:5:25)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (C:\Users\karan\AppData\Roaming\npm\node_modules\cordo
va\node_modules\run-parallel\index.js:4:24)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)`

Solution

  • Ok so for this problem the solution is to update the npm version too.

    But now I am having trouble installing cordova-plugin-firebase-lib , Sometimes it throws errr color.xml already exists and sometime say dont have permission