Ionic serve throwing npm error


#1

Im running a sample app, and I am getting the following error,

25 error Failed at the ionic-hello-world@ ionic:serve script ‘ionic-app-scripts serve “–v2” “–address” “0.0.0.0” “–port” “8100” “–livereload-port” “35729”’.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the ionic-hello-world package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error ionic-app-scripts serve “–v2” “–address” “0.0.0.0” “–port” “8100” “–livereload-port” “35729”

I have the latest npm installed.


#2

ionic info output please.


#3

Cordova CLI: Not installed
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.2.1
Xcode version: Not installed


#4

Then package.json content please.


#5
{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "clean": "ionic-app-scripts clean",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "engines": {
    "node": "6.9.2"
  },
  "dependencies": {
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.1.1",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.5"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.5",
    "typescript": "2.2.1"
  },
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "ionic-preview-app: An Ionic project"
}


#6

There is a 1.3.7 of that now, you could try updating to that.


#7

I did that, but still getting the same error. Do I need to re-build the environment?


#8

It doesn’t appear that you have Cordova installed, or at least the CLI seems to think so.

Have you installed Cordova?


#9

Not relevant for ionic serve, see his topic title.


#10

Not really. Can you show us the version of your node and npm please, just to be sure?
Did you try with an older version, LTS maybe?


#11

Run following commands:

  1. npm install -g cordova ionic
  2. ionic start myApp tabs
  3. cd myApp
  4. ionic serve

This will setup your project from scratch and then you can take over from there.


#12

npm version 4.5.0. I did not try with the older version


#13

Why is your node 6.9 here but just 6.2 in “real life”? Also it should be at least 6.10 now. But there seems to be a disconnect between your dependencies and your actual installation. When was the last time you ran npm install?


#14

I ran it day before yesterday


#15

I did this now, but still i face the same error. the weird part is , it was working well in the morning and I did not make any changes but it stopped all of a sudden since then I get the above error.


#16

Have you restarted your computer?


#17

yup, I did restart my system.