Typescript Error '=' expected and more

Hi everyone. I installed ionic 3 by typing

npm install -g ionic cordova

and i created new project by typing

ionic start helloWorld blank --type=ionic-angular

After ionic serve i got theese following errors.



And console log says:

Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. (index):1
Failed to load resource: the server responded with a status of 404 (Not Found) (vendor.js):1
Failed to load resource: the server responded with a status of 404 (Not Found) (main.js):1

Ionic CLI: 5.4.13
Ionic Framework: ionic-angular 3.9.9
@ionic/app-script: 3.2.4

Angular Core and Angular Compeiler CLI: 5.2.11

NodeJS: 12.4.1(LTS)
npm: 6.13.4
OS: Linux 5.0

I found this article says just ctrl+s in any .ts file and let it build again.
Yes it is working for this serve time. But i get same error every time i serve.

have you try remove and install node_modules again, delete www folder and run again you build.

Yes and yes. Btw no error pops to my face in ionic 4. Something is wrong with ionic 3 :slight_smile:

But this command is to install lasted version of ionic, to install ionic 3 is

npm install -g ionic@3.x.x

Try update ionic-angular
Execute this command in root folder of you project.

npm rm @ionic/angular --save
npm install @ionic/angular --save

But ionic 3 docs says, to install ionic

npm install -g ionic cordova

I believe i should understand from this, run this command to install ionic 3 because this is ionic 3 docs.
When i’m in ionic 4 docs it says, to install ionic

npm install -g ionic

And i should understand from this, run this command to install ionic 4.
Am i wrong?
But still i am going to try your way. Thanks

“Ionic 3” is not a thing. “Ionic 4” is not a thing. Conversations will go much more smoothly here if we all agree to never pretend that “Ionic” is a monolithic thing that has a version number.

The thing you install globally (with npm i -g ionic) is the Ionic CLI. The only time you want an older version of that than the latest available is if there is an unfixed bug in the latest version. This is not one of those situations. You DO NOT WANT an old version of the Ionic CLI just because you want to work on an app that uses an older version of the Ionic framework.

The current version of the Ionic CLI as I write this is 5.4.13. That is what you want.

All of that matches my environment, in which I just spawned a new ionic-angular (aka Ionic framework v3) app, which built without error, so there is some other problem with your environment. Please post the entire package.json from the offending project. I’m assuming that you haven’t changed any of the generated skeleton source code yet.

Here is my package.json:

{
    "name": "hellowifi",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "start": "ionic-app-scripts serve",
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint"
    },
    "dependencies": {
        "@angular/animations": "5.2.11",
        "@angular/common": "5.2.11",
        "@angular/compiler": "5.2.11",
        "@angular/compiler-cli": "5.2.11",
        "@angular/core": "5.2.11",
        "@angular/forms": "5.2.11",
        "@angular/platform-browser": "5.2.11",
        "@angular/platform-browser-dynamic": "5.2.11",
        "@ionic-native/android-permissions": "^5.19.1",
        "@ionic-native/core": "^4.20.0",
        "@ionic-native/network": "^4.20.0",
        "@ionic-native/splash-screen": "4.20.0",
        "@ionic-native/status-bar": "4.20.0",
        "@ionic/storage": "2.2.0",
        "@types/node": "^13.1.4",
        "cordova-android": "8.1.0",
        "cordova-plugin-android-permissions": "^1.0.2",
        "cordova-plugin-camera": "^4.1.0",
        "cordova-plugin-network-information": "^2.0.2",
        "ionic-angular": "3.9.9",
        "ionicons": "3.0.0",
        "rxjs": "5.5.11",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.29"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^3.2.4",
        "typescript": "2.6.2",
        "cordova-plugin-whitelist": "1.3.3",
        "cordova-plugin-statusbar": "2.4.2",
        "cordova-plugin-device": "2.0.2",
        "cordova-plugin-splashscreen": "5.0.2",
        "cordova-plugin-ionic-webview": "^4.0.0",
        "cordova-plugin-ionic-keyboard": "^2.0.5"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-android-permissions": {},
            "cordova-plugin-camera": {},
            "cordova-plugin-network-information": {},
            "cordova-plugin-whitelist": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-ionic-keyboard": {}
        }
    }
}

And yes i understand now what i am doing here about Ionic CLİ. It isnt the npm install part for v3 or v4 app. It is about ionic start command. But all i did was follow the instruction in docs. This computer was formatted recently. After format i installed node lts version from nvm. Jdk, Sdk etc. And after that just run npm install ionic and ionic start helloWorld blank --type=ionic-angular. It shouldn’t give me any error if this is 0km computer i believe.

Tried that didn’t work.

I believe your proximate problem is a fight between these two folks. The first thing I would try is bumping typescript to 2.7.2, and if that fixes this problem but causes others, then look for a version of @types/node that doesn’t contain the “unique symbol” construct.

1 Like

I updated typescript by typing npm install typescript@2.7.2 and worked.
Thank you very much. But why this problem happened? I followed instructions. It should install what everything its need right?

That’s a good question. I played along with you yesterday, but my ionic-angular project did not get @types/node in its package.json at all, so while I did get typescript 2.6.2 like you did, I didn’t have the problematic @types/node with its >=2.7 syntax. Can you think of anything you did after spawning the project that may have caused that to get in there?

By the way, I’ve been assuming throughout this convo that you have some very specific and compelling reason to be wanting to start a new framework v3 ionic-angular project now. If that’s not the case, I would really recommend just going with type=angular, if for no other reason than there are far more eyes on that, so any problems you run into should be (a) marginally less strange and (b) perhaps a higher priority for getting fixed upstream.

ADDENDUM: if this is more than a toy proof-of-concept, you’ve also got a lurking time bomb in that you’re mixing ionic-native v4 and v5 parts. They all must be on the same major version number (strictly speaking, @ionic-native/foo must have the same major version as @ionic-native/core, but the transitive property of dependencies (to coin a rather awkward phrase) means that all @ionic-native/* has to share the same major version).

1 Like

No. I just developed little bit more for ui part after start. And install some plugins. But this problem been there for all time. Didn’t happened after i installed or did something. I wondered if i did something that cause this problem and start completely new v3 project and still the problem was there, waiting for me :slight_smile:
I wanted to use v3 because i developed few project with it. After CLI updated 4 getting use to it was not easy for me. But i am going to.
Thank you for all your advise.

That’s understandable. I’ll just say that if you’re thinking that the difference / learning curve between framework v3 (type=ionic-angular) and v4 (type=angular) is anywhere near that encountered when going from v1 (type=ionic1), it’s not. AngularJS to Angular entails a complete app redesign. Angular 5 and ionic-angular to Angular 8 (9 any day now, I expect) and @ionic/angular is much more incremental/minimal.