Ionic-cli: ionic serve fails on Ubuntu 16.04

Created on 28 Mar 2017  路  10Comments  路  Source: ionic-team/ionic-cli

_From @knesebeck on March 28, 2017 11:26_

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When creating a new Ionic 2 project with ionic start myApp --v2 and starting it with ionic serve, the following messages appear:

> ionic-hello-world@ ionic:serve /home/user/ionic//myApp
> ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"

but no browser is opened, and no server is listening on port 8100.

Expected behavior:
browser opens and serves the ionic 2 app from localhost:8100

Steps to reproduce:

ionic start myApp --v2
ionic serve

Other information:
When manually calling:

node node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js serve "--v2" "--address" "0.0.0.0" "--port" "8100"

the app is served at localhost:8100 as desired

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.9
Node Version: v7.6.0
Xcode version: Not installed

npm ls: (only errors shown)

UNMET PEER DEPENDENCY [email protected]

_Copied from original issue: driftyco/ionic#10943_

Most helpful comment

The culprit seems to be in the @ionic/app-scripts dependency. When reverting @ionic/app-scripts from 1.2.2 back to 1.1.4 in package.json, ionic serve seems to work as desired again.

All 10 comments

_From @krlwlfrt on March 28, 2017 12:31_

I'm having the same problem on my system:

$ ionic info

Your system information:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.10
Node Version: v7.7.4
Xcode version: Not installed

EDIT: the workaround with calling the script directly works for me too.

_From @iget-master on March 28, 2017 13:56_

I'm having the same issue here.

Just installed Ionic as described on the docs.

Your system information:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.10.1
Xcode version: Not installed

Running on Ubuntu 16.04, with nginx running on port 80.

me@my-host:~/Sandbox/firstionic$ ionic serve

> ionic-hello-world@ ionic:serve /home/me/Sandbox/firstionic
> ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"

Also have the same error on npm ls:

UNMET PEER DEPENDENCY [email protected]

The workarround works here.

_From @JuanELo-O on March 28, 2017 15:23_

Hi all!

I'm having same issue but a feel a little better (I was beginning to think that I was the only one).

My system information.

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.10.1
Xcode version: Not installed

By the way, I'm in ubuntu too:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:   xenial

The workaround works for me too.

Thanks @knesebeck

Same problem with Ubuntu 16.04:
Workaround working fine:
sudo node node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js serve "--v2" "--address" "0.0.0.0" "--port" "8100"
Here's the ionic info command:

Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.5.0

Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v7.6.0
Xcode version: Not installed

The culprit seems to be in the @ionic/app-scripts dependency. When reverting @ionic/app-scripts from 1.2.2 back to 1.1.4 in package.json, ionic serve seems to work as desired again.

Finally, someone got the same issue as me, I started getting it since 18 hours ago, 28-Mar-2017 NZ time.

Your system information:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.9
Node Version: v6.10.0
Xcode version: Not installed

As mentioned by @knesebeck, I actually compared the content of package.json with old blank template, the app-scripts version changed from 1.1.4 to 1.2.2, not sure what the ionic team has changed, I am looking into it. I hope someone will fix it soon.

Hey folks,

It seems that if you update your Ionic CLI to v3 beta version, this issue disappears. Just run the following command:

sudo npm install -g ionic@beta

However, once you upgraded to the beta version, your newly created project will need to follow the instruction here to get going. I probably uses what @knesebeck suggested, change app-scripts back to version 1.1.4 to use CLI 2.2.1.

Same issue here:
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.10.1
Xcode version: Not installed

Workaround:

  • $ npm install @ionic/[email protected] and
  • "@ionic/app-scripts": "1.1.4" in package.json...
    as already suggested by @knesebeck and @Gengjun-VVU .

Thanks a lot , I spent some days searching for this solution!

I am facing same issue on my Ubuntu system.
I have made a fresh install of Ubuntu in a virtual machine for testing purposes.

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial

Your system information:

Cordova CLI: 6.5.0 
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.10.2
Xcode version: Not installed

Running ionic serve does not open the browser.
Using the suggested workaround did not work.

However if I run the command ionic serve -w firefox it works fine.

This issue has been automatically closed because it had the v2 label. Please install the new CLI v3 (npm install -g ionic@latest). See CHANGELOG.md#Upgrading from CLI v2 for details.

If this issue is still a problem in CLI v3, please create a new issue. Thank you!

Was this page helpful?
0 / 5 - 0 ratings