Error: Cannot find module 'nopt' on Cordova 9.0.0

1.4k Views Asked by At

I upgraded Cordova from 8.1.1 to 9.0.0 and when I build my Android app, I get the following error :

{ Error: Cannot find module 'nopt'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/Users/gabriela.banica/Projects/SmartHome-UI-Core/dist/innogy/essen-test/android/platforms/android/cordova/lib/build.js:25:12)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /Users/gabriela.banica/Projects/SmartHome-UI-Core/dist/innogy/essen-test/android/platforms/android/cordova/Api.js:304:16
at _fulfilled (/Users/gabriela.banica/Projects/SmartHome-UI-Core/dist/innogy/essen-test/android/node_modules/q/q.js:854:54)
at /Users/gabriela.banica/Projects/SmartHome-UI-Core/dist/innogy/essen-test/android/node_modules/q/q.js:883:30
at Promise.promise.promiseDispatch (.../android/node_modules/q/q.js:816:13)
at .../android/node_modules/q/q.js:624:44
at runSingle (.../android/node_modules/q/q.js:137:13)
at flush (.../android/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11) code: 'MODULE_NOT_FOUND' }

Any idea how could this be fixed?

1

There are 1 best solutions below

0
On

Try to remove/add the platform again

cordova platform rm android
cordova platform add android@latest