Ionic cordova emulate android

when I am try to emulate android device it shows following error:

Error: ./~/firebase/app/shared_promise.js
Module not found: Error: Can’t resolve ‘promise-polyfill’ in ‘/root/PhotoEditor/node_modules/firebase/app’
resolve ‘promise-polyfill’ in ‘/root/PhotoEditor/node_modules/firebase/app’
Parsed request is a module
using description file: /root/PhotoEditor/node_modules/firebase/package.json (relative path: ./app)
Field ‘browser’ doesn’t contain a valid alias configuration
after using description file: /root/PhotoEditor/node_modules/firebase/package.json (relative path: ./app)
resolve as module
looking for modules in /root/PhotoEditor/node_modules
using description file: /root/PhotoEditor/package.json (relative path: ./node_modules)
Field ‘browser’ doesn’t contain a valid alias configuration
after using description file: /root/PhotoEditor/package.json (relative path: ./node_modules)
using description file: /root/PhotoEditor/package.json (relative path: ./node_modules/promise-polyfill)
as directory
/root/PhotoEditor/node_modules/promise-polyfill doesn’t exist
no extension
Field ‘browser’ doesn’t contain a valid alias configuration
/root/PhotoEditor/node_modules/promise-polyfill doesn’t exist
.ts
Field ‘browser’ doesn’t contain a valid alias configuration
/root/PhotoEditor/node_modules/promise-polyfill.ts doesn’t exist
.js
Field ‘browser’ doesn’t contain a valid alias configuration
/root/PhotoEditor/node_modules/promise-polyfill.js doesn’t exist
.json
Field ‘browser’ doesn’t contain a valid alias configuration
/root/PhotoEditor/node_modules/promise-polyfill.json doesn’t exist
[/root/PhotoEditor/node_modules/promise-polyfill]
[/root/PhotoEditor/node_modules/promise-polyfill]
[/root/PhotoEditor/node_modules/promise-polyfill.ts]
[/root/PhotoEditor/node_modules/promise-polyfill.js]
[/root/PhotoEditor/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.module.ts
@ ./src/app/main.ts

I updated cli plugins but still it show this errror

Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of
date.

Anyhelp thanks

Post your ionic info output please.

mm sure

@ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0

local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.3.0

System:
Node : v8.0.0
OS : Linux 4.6
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 5.0.3

Does ionic serve work with your project?
What exact command are you executing to emulator on Android?

When does it show that error?

yes ionic serve is perfectly working…i used

ionic cordova emulate android

cmd to emulate android device

And where exactly do you get the error you posted in your first message?

when i execute this command

npm install promise-polyfill --save-exact

above error is corrected

but now when i try to run

cordova run android

i get this error

Error: Failed to find ‘ANDROID_HOME’ environment variable. Try setting setting it manually.
Detected ‘android’ command at /usr/bin but no ‘tools’ directory found near.
Try reinstall Android SDK or update your PATH to include valid path to SDK/tools directory.

i set the path in .bashrc file

$export ANDROID_HOME=/usr/bin/android-sdk-linux
$export PATH=$PATH:$ANDROID_HOME/tools
$export PATH=$PATH:$ANDROID_HOME/platform-tools

but still there is above error

That is something completely different. Please create a new topic for this.

1 Like

solving this error…after completly solved i post the answer…Thanks for your reply @Sujan12

the solution to this problem is npm install promise-polyfill --save-exact