Skip to content

exception ionic cordova run browser after upgrade to 3.15.0 #2826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luckychel opened this issue Oct 25, 2017 · 16 comments
Closed

exception ionic cordova run browser after upgrade to 3.15.0 #2826

luckychel opened this issue Oct 25, 2017 · 16 comments

Comments

@luckychel
Copy link

luckychel commented Oct 25, 2017

Description:

after upgrade to ionic cli 3.15.0 fired an exception
only downgrade to 3.14.0 ionic cordova run browser works fine

$ ionic cordova run browser

cordova platform add browser --save
Using cordova-fetch for cordova-browser@^4.1.0

Error: Platform browser already added.

[ERROR] Exception:

My ionic info:

$ ionic info

? The Ionic CLI has an update available (3.14.0 => 3.15.0)! Would you like to install it? No
Not automatically updating your CLI.

cli packages: (C:\Users\kukoba.av\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.14.0
ionic (Ionic CLI) : 3.14.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3 browser 4.1.0
Ionic Framework    : ionic-angular 3.6.1

System:

Android SDK Tools : 25.2.3
Node              : v6.11.2
npm               : 3.10.10
OS                : Windows 10

Misc:

backend : legacy
@luckychel luckychel reopened this Oct 25, 2017
@celinakhalife
Copy link

I found a temporary solution, remove the browser platform:

  • ionic cordova remove platform browser --save
    Then run your project with livereload
  • ionic cordova run browser --livereload
    For some reason, when you run the project, the CLI is always adding the browser platform.
    If the browser platform is already added, it will return an error and the run will be aborted.
    Running the project with livereload will automatically re-run the project once changes are saved.

@luckychel
Copy link
Author

thanks for temp solution

@dev-manager-uk
Copy link

We have the same bug.

Every time you run:
ionic cordova remove platform browser

Then the next time you run:
ionic cordova run browser

Then it builds correctly.

The 2nd time you run:
ionic cordova run browser

it fails every time.

@ThorvaldAagaard
Copy link

I have the same problem.

I just reverted to 3.14.0 with the command

npm install [email protected]

I think it might be ionic/[email protected] that is causing problems, as there is a fix that it should only return valid platforms. That might have introduced the error

@dev-manager-uk
Copy link

thanks @ThorvaldAagaard

Are there any downsides to permanently targeting a specific version like this?

And then only upgrading that version when we need new features from the latest release?

@ThorvaldAagaard
Copy link

Version 3.14.0 was only 2 days old before 3.15.0 arrived, so I guess it will be easy to fix.

But generally it should be ok to stick with a specific version like all other npm-packages, and then plan the upgrade. Only issue is that when you update all at the same time it might be difficult to see what introduces the error

@dev-manager-uk
Copy link

ok, thank you!

@imhoffd
Copy link
Contributor

imhoffd commented Oct 25, 2017

Sorry about that. Please keep in mind we don't "officially" support the browser platform yet--see #2312.

This issue should be fixed in 3.15.1.

@dev-manager-uk
Copy link

@dwieeb I was under the impression that Ionic fully supported the browser. Am I wrong?

"Ionic is the perfect platform for building progressive web apps"
" it’s already built to work perfectly in the browser"
http://blog.ionic.io/navigating-the-world-of-progressive-web-apps-with-ionic-2/

@mhartington perhaps you can clarify also?

"We support Safari, Chrome, firefox, and Edge."
mhartington - Ionic Team - Apr 28
https://forum.ionicframework.com/t/does-ionic-support-browser-project-and-which/88102/7

Also:
http://blog.ionic.io/announcing-pwa-support-in-ionic-2/
https://ionicframework.com/docs/developer-resources/desktop-support/

We are investing considerable time into an iOS, Android and Web Browser based app. If Ionic are not planning to support the browser we would have to reevaluate our approach.

Many thanks.

@kensodemann
Copy link
Member

@dev-manager-uk - I believe they are just talking about the cordova browser platform, which is more of plugin testing platform, at least currently. Many plugins don't work with it and some that do work with it do so by providing mock data and not real data. Others work great!

Running the browser, though, is perfectly fine. See the advice given here: https://blog.ionic.io/how-to-make-pwas-with-ionic/ pertaining to commenting out cordova.js if you are just going to run in the browser and about other current advice for deploying the application for web.

If running on both a native and a web environment, this article shows how to deal with the lack of plugins by either using Ionic Native and getting a warning but continuing on but without the support of the plugin functionality or by having separate code run depending environment: https://ionicframework.com/docs/developer-resources/desktop-support/

Finally, I find this page very helpful when running from the browser: https://whatwebcando.today

@dev-manager-uk
Copy link

Thank you @kensodemann

I understand that lots of plugins might not work as well on web compared to mobile. Fair enough.

However I don't understand why that is being used as an excuse for releasing a version of ionic-cli that breaks "ionic cordova run browser" because you don't "officially" support it.

Or is there a different command that you do "officially" support?

@ThorvaldAagaard
Copy link

I am using the browser platform and deploying it to firebase.

That is working fine, but it would be nice if it was a supported platform at the same level as the others.

After the latest update of ionic that fixed the problem with the platform getting added, there is still an issue as the command

ionic cordova build browser --prod

now fails with this error

Error: ./node_modules/rxjs/observable/BoundCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Object.getEffectiveTypeAnnotationNode (typescript.js:9341:17)

@dev-manager-uk
Copy link

Just seen #13248

So are you saying that instead of:
ionic cordova build browser --prod

We should be using:
npm run ionic:build -- --prod

@kensodemann
Copy link
Member

kensodemann commented Oct 26, 2017

Yes. Per the "Deploying" section of this article: https://blog.ionic.io/how-to-make-pwas-with-ionic/

But you will have to make sure you use web API calls to replace the functionality of the Cordova plugins that won't be there per the "plugins" section of this article: https://ionicframework.com/docs/developer-resources/desktop-support/

That is my suggestion, anyhow.

@dev-manager-uk
Copy link

Thanks Ken, we'll give that a go.

@dev-manager-uk
Copy link

We have updated our build from:
ionic cordova build browser --prod

to use instead:
npm run ionic:build -- --prod

And it's now working.

Thank you for your help @kensodemann @dwieeb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants