Error with Ionic cordova build android --device

I am running command ionic cordova run android --device
and getting this error:

Error: ./~/firebase/app/shared_promise.js Module not found: Error: Can't resolve 'promise-polyfill' in 'C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modu les\firebase\app' resolve 'promise-polyfill' in 'C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\firebase\app' Parsed request is a module using description file: C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\firebase\package.json (relative path: ./app) Field 'browser' doesn't contain a valid alias configuration after using description file: C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\firebase\package.json (rel ative path: ./app) resolve as module looking for modules in C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules using description file: C:\Users\aksha\Desktop\ionic_apps\HireTranslator\package.json (relative path: ./node_mod ules) Field 'browser' doesn't contain a valid alias configuration after using description file: C:\Users\aksha\Desktop\ionic_apps\HireTranslator\package.json (relative path: ./no de_modules) using description file: C:\Users\aksha\Desktop\ionic_apps\HireTranslator\package.json (relative path: ./node_m odules/promise-polyfill) as directory C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill.ts doesn't exist no extension Field 'browser' doesn't contain a valid alias configuration C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill doesn't exist .js Field 'browser' doesn't contain a valid alias configuration C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill.json doesn't exist [C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill.ts] [C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill] [C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill] [C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill.js] [C:\Users\aksha\Desktop\ionic_apps\HireTranslator\node_modules\promise-polyfill.json] @ ./~/firebase/app/shared_promise.js 38:35-62 @ ./~/firebase/app/firebase_app.js @ ./~/firebase/app.js @ ./src/providers/af-auth/af-auth.ts @ ./src/pages/home/home.module.ngfactory.ts @ ./src async @ ./~/ionic-angular/util/ng-module-loader.js @ ./src/app/app.module.ngfactory.ts @ ./src/app/main.ts

Please help, thanks :slight_smile:

Something in the firebase library is broken. How did you add it? Did you run npm install?

yeah I did but it works when I run ionic serve, things work as expected and even works on phone when i build without --prod tag :frowning:

So you are not getting this error while building but when running the build on the device?

I am getting the error while building.

ionic cordova run android --device
Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --externalIpRequired --nobrowser

[07:59:06]  build dev started ... 
[07:59:06]  clean started ... 
[07:59:06]  clean finished in 4 ms 
[07:59:06]  copy started ... 
[07:59:06]  transpile started ... 
[07:59:11]  transpile finished in 4.25 s 
[07:59:11]  preprocess started ... 
[07:59:11]  deeplinks started ... 
[07:59:11]  deeplinks finished in 127 ms 
[07:59:11]  preprocess finished in 129 ms 
[07:59:11]  webpack started ... 
[07:59:11]  copy finished in 4.53 s 
[WARN] Error occurred during command execution from a CLI plugin
       (@ionic/cli-plugin-cordova). Your plugins may be out of date.
Error: ./~/firebase/app/shared_promise.js
Module not found: Error: Can't resolve 'promise-polyfill' in '/home/ai/labbo/node_modules/firebase/app'
resolve 'promise-polyfill' in '/home/ai/labbo/node_modules/firebase/app'
  Parsed request is a module
  using description file: /home/ai/labbo/node_modules/firebase/package.json (relative path: ./app)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /home/ai/labbo/node_modules/firebase/package.json (relative path: ./app)
    resolve as module
      looking for modules in /home/ai/labbo/node_modules
        using description file: /home/ai/labbo/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /home/ai/labbo/package.json (relative path: ./node_modules)
          using description file: /home/ai/labbo/package.json (relative path: ./node_modules/promise-polyfill)
            as directory
              /home/ai/labbo/node_modules/promise-polyfill doesn't exist
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/ai/labbo/node_modules/promise-polyfill doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/ai/labbo/node_modules/promise-polyfill.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/ai/labbo/node_modules/promise-polyfill.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/ai/labbo/node_modules/promise-polyfill.json doesn't exist
[/home/ai/labbo/node_modules/promise-polyfill]
[/home/ai/labbo/node_modules/promise-polyfill]
[/home/ai/labbo/node_modules/promise-polyfill.ts]
[/home/ai/labbo/node_modules/promise-polyfill.js]
[/home/ai/labbo/node_modules/promise-polyfill.json]
 @ ./~/firebase/app/shared_promise.js 37:35-62
 @ ./~/firebase/app/firebase_app.js
 @ ./~/firebase/app.js
 @ ./~/firebase/firebase-browser.js
 @ ./src/app/app.component.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts

I get the same error.
when I ionic cordova run android --device

1 Like

A post was split to a new topic: Module not found: Error: Can’t resolve ‘…/…/angularfire2/auth’