Working on a IONIC 2 application : serve error


#1

Hello!

I’m new to Ionic, and I have to debug and compile an Android app which was created by another person a few months ago, and who’s not in the team anymore (I joined after he left).

The development lasted from the 22th of Nov 2016 to the 27th of January in 2017.

The 1st commit in git contained the following information in package.json :

+  "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.2",
+    "ionic-native": "2.2.3",
+    "ionicons": "3.0.0",
+    "rxjs": "5.0.0-beta.12",
+    "zone.js": "0.6.21"
+  },
+  "devDependencies": {
+    "@ionic/app-scripts": "0.0.44",
+    "typescript": "2.0.6"
+  },
+  "cordovaPlugins": [
+    "cordova-plugin-whitelist",
+    "cordova-plugin-console",
+    "cordova-plugin-statusbar",ioni
+    "cordova-plugin-device",
+    "ionic-plugin-keyboard",
+    "cordova-plugin-splashscreen"

And those numbers are the same after the last commit.

I tried to upgrade the whole thing to IONIC 3 but it went nowhere. I may do that later but it will take some time, and right now I need to compile an APK in the coming days.

My best chance is to get the same working environment as the initial developer.
I uninstalled everything and installed ionic and cordova on these versions :
Ionic 2.2.3 (indicated in package.json)
Cordova 6.3.0 (didn’t see the version anywhere but it seems like it was the recent version in november 2016)
Tried a “npm install” which gave red flags :

+-- UNMET PEER DEPENDENCY @ionic/app-scripts@0.0.44
+-- UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12

The ionic serve gave a blank page, with the following error in the console :
build dev failed: Cannot set property ‘fileSystem’ of null

I then installed @ionic/app-scripts@0.0.44 to get as close as possible to the initial environment… (but should I move the order of the dependencies in the json to avoid these errors?)

Same result when I launch serve, still “build dev failed: Cannot set property ‘fileSystem’ of null”…

I’ve seen a few pages on the web talking about this error message, but can’t see any solution which would seem relevant to my case (I did try some things I saw there when I was trying with different versions of Ionic, Cordova and so on… to on avail).

 ordova CLI: 6.3.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 0.0.44
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.3
Xcode version: Not installed

The result of npm install now :

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @ionic-native/core@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic-native/splash-screen@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic-native/status-bar@3.7.0 requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @ionic/cli-plugin-ionic-angular@1.0.0 requires a peer of @ionic/app-scripts@^1.3.1 but none was installed.

The target platform will be android, but for now I’d just like to get something working on my dev environment !
I’m pretty close to what the initial dev used. Any idea on what could be the problem right now?

Thanks!


#2

The ionic you install is not related in any way to anything in package.json. It is the CLI that is used to build your app. But 2.2.3 was the last stable version of the v2 branch of Ionic CLI, so you should be fine with this version.

This app is using Ionic Framework (ionic-angular) in version 2.0.0-rc.2 which is really, really old. You should definitely update this as soon as possible.

The bigger problem will be app-scripts, I don’t think you will make any progress with the mentioned version. I would advise you to go to the newest one 1.3.7 as this works well with your CLI version and should also be fine with the Framework version.

If you made this change, tryo running ionic serve again and tell us the exact error message you are getting.


#3

I see, thanks for your answer !

After the “npm install -g @ionic/app-scripts@1.3.7”, my app scripts version didn’t change, and I’ve got the following errors and warnings:

+-- UNMET PEER DEPENDENCY @angular/compiler@*
+-- UNMET PEER DEPENDENCY @angular/compiler-cli@*
+-- UNMET PEER DEPENDENCY @angular/core@*
+-- UNMET PEER DEPENDENCY @angular/tsc-wrapped@*
+-- @ionic/app-scripts@1.3.7
| `-- UNMET PEER DEPENDENCY typescript@>=1.7.3
+-- UNMET PEER DEPENDENCY rxjs@*
+-- UNMET PEER DEPENDENCY sw-toolbox@*
+-- UNMET PEER DEPENDENCY typescript@*
`-- UNMET PEER DEPENDENCY zone.js@*

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@ionic\app-scripts\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @ionic/app-scripts@1.3.7 requires a peer of @angular/core@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of @angular/compiler@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of @angular/compiler-cli@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of @angular/tsc-wrapped@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of rxjs@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of sw-toolbox@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of typescript@* but none was installed.
npm WARN @ionic/app-scripts@1.3.7 requires a peer of zone.js@* but none was installed.
npm WARN tslint@3.15.1 requires a peer of typescript@>=1.7.3 but none was installed.

Would I need to update Typescript ? In the same vein, I’d like to avoid breaking existing code, but I guess I could do with this one. Thing is, there are many others “UNMET PEER DEPENDENCY”, that does not bode well (oh, I guess we’ll find a way, just wanted to say that).

Btw, is there a command to install this version of app-scripts with its dependencies all at once, or is it necessary (or simply better) to do it one by one?


#4

The -g was wrong here - you don’t want to install app-scripts globally but just in this project (Please uninstall the global version of it). You could also just edit package.json and then run npm install in this directory.


#5

It worked beautifully, thanks a lot!

I still have errors popping during the launch, but it’s more code related and I should be able to work that out. That would be another forum topic if needed anyway.

For you : :cookie: and :pizza: !!


#6

@asaurat_ovr… Try this
npm uninstall -g ionic
npm install -g ionic@2.2.1


#7

Hell no, why should he downgrade to this old version of the Ionic CLI?


#8

#9

Thanks, but the issue is solved. Is there a way to close the topic?


#10