No ionic-app-scripts copy / watch before serve / build / run with rc.3


#1

Hi all,

since this happened the second time to me atfer updating ionic (and I do not remember how I fixed it the last time), I would like to ask why the watch / copy task before executing “serve” or other command may stop working after an update.

What happends? When executing “ionic serve”, the live server is started immediately. So that means that the watch / copy task is not executed before and thus no / no new content is available in the www directory.

How and why does that happen?

ionic info:
Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.0-beta.3
Ionic App Lib Version: 2.1.0-beta.1
OS:
Node Version: v7.0.0

package.json:

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "ionic-angular": "2.0.0-rc.3",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.46",
    "typescript": "2.0.6"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "MyInoic2Project: An Ionic project"
}

#3

OK, some progress which may point to the problem: I can execute the scripts directly via “npm run” and get a proper result:

> npm run ionic:serve

> ionic-hello-world@ ionic:serve D:\Entwicklung\VeranstaltungsApp
> ionic-app-scripts serve

[15:17:09]  ionic-app-scripts 0.0.43
[15:17:09]  watch started ...
[15:17:09]  build dev started ...
[15:17:09]  clean started ...
[15:17:09]  clean finished in less than 1 ms
[15:17:09]  copy started ...
[15:17:09]  transpile started ...
[15:17:13]  transpile finished in 4.65 s
[15:17:13]  webpack started ...
[15:17:14]  copy finished in 4.94 s
[15:17:21]  webpack finished in 7.29 s
[15:17:21]  sass started ...
[15:17:23]  sass finished in 1.86 s
[15:17:23]  build dev finished in 13.86 s
[15:17:23]  watch ready in 14.01 s
[15:17:23]  dev server running: http://localhost:8100/

#4

Again, I do not know which of my steps fixed it, but it works again (uninstalled and installed node, npm, ionic, …). Interestingly, ionic info now outputs much more information again:

Your system information:

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.2.0
Xcode version: Not installed

#5

I see your ionic app scripts in package.json is latest but npm run command showed 0.0.43…
I think running npm install ionic-app-scripts@latest would have worked.
or in the worst case , in my experience deleting the node_modules folder in the project and running npm install on the project fixes it.