0

I am getting the following output when running ionic serve in my project directory:

ERROR in node_modules/typesense/lib/Typesense/Documents.d.ts(2,13): error TS1005: '=' expected.
[ng] node_modules/typesense/lib/Typesense/Documents.d.ts(2,33): error TS1005: ';' expected.
[ng] node_modules/typesense/lib/Typesense/SearchOnlyDocuments.d.ts(4,13): error TS1005: '=' expected.
[ng] node_modules/typesense/lib/Typesense/SearchOnlyDocuments.d.ts(4,87): error TS1005: ';' expected.
[ng] 

I recognized that this error was very similar to this question I asked recently: Firebase When deploying Cloud Function with Typesense Type 'T' does not satisfy the constraint 'DocumentSchema'

In that post the problem turned out to be that I was using different global and local versions of typescript. It was the case, in this project that the versions were off, so I fixed it. The following details my versions:

npm ls typescript -g
/usr/local/lib
└── [email protected] 

npm ls typescript
[email protected] /home/me/myproject
├─┬ @angular-devkit/[email protected]
│ └─┬ @angular-devkit/[email protected]
│   └── [email protected] 
├─┬ @angular/[email protected]
│ └─┬ @schematics/[email protected]
│   └── [email protected] 
├─┬ @ionic/[email protected]
│ └── [email protected]  deduped
└── [email protected] 

For some reason this project wants to pull different typescript versions for different dependencies, however, as you can see above, I managed to get them all on the same version of typescript.

Below is my package.json. This all runs smoothly when doing npm install, with no errors:

{
  "name": "myproject",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "7.2.16",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "7.2.16",
    "@angular/core": "7.2.16",
    "@angular/fire": "^5.2.1",
    "@angular/forms": "7.2.16",
    "@angular/material": "^7.3.7",
    "@angular/platform-browser": "7.2.16",
    "@angular/platform-browser-dynamic": "7.2.16",
    "@angular/router": "7.2.16",
    "@babel/runtime": "^7.19.4",
    "@ctrl/ngx-emoji-mart": "^0.17.0",
    "@firebase/testing": "^0.20.11",
    "@google-cloud/firestore": "^3.8.6",
    "@ionic-native/badge": "^5.35.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/file-chooser": "^5.9.0",
    "@ionic-native/geolocation": "^5.13.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^4.6.0",
    "@ng-bootstrap/ng-bootstrap": "^4.0.0",
    "@types/googlemaps": "^3.37.5",
    "angular-calendar": "^0.27.14",
    "angular-material-expansion-panel": "^0.7.2",
    "cordova-browser": "5.0.4",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-geolocation": "4.0.2",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^4.1.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "core-js": "^2.5.4",
    "date-fns": "^1.30.1",
    "dateformat": "^5.0.2",
    "firebase": "^6.2.4",
    "ini": "^2.0.0",
    "ionic2-calendar": "^0.5.2",
    "ng-bootstrap": "^1.6.3",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.5.2",
    "tslib": "^2.3.1",
    "typesense": "^1.4.1",
    "zone.js": "~0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/architect": "^0.1201.3",
    "@angular-devkit/build-angular": "~0.13.7",
    "@angular-devkit/core": "~7.3.7",
    "@angular-devkit/schematics": "~7.3.7",
    "@angular/cli": "~7.3.7",
    "@angular/compiler": "7.2.16",
    "@angular/compiler-cli": "7.2.16",
    "@angular/language-service": "7.2.16",
    "@ionic/angular-toolkit": "~1.4.1",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~12.0.0",
    "codelyzer": "~4.5.0",
    "cordova-plugin-badge": "^0.8.8",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~8.3.0",
    "tslint": "~5.17.0",
    "typescript": "3.2.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-geolocation": {},
      "cordova-plugin-badge": {}
    },
    "config": {
      "ionic_copy": "./config/copy.config.js"
    },
    "platforms": [
      "browser"
    ]
  }
}

Please let me know what else I can do to resolve this.

If the answer is to make this:

[email protected] /home/me/myproject
├─┬ @angular-devkit/[email protected]
│ └─┬ @angular-devkit/[email protected]
│   └── [email protected] 
├─┬ @angular/[email protected]
│ └─┬ @schematics/[email protected]
│   └── [email protected] 
├─┬ @ionic/[email protected]
│ └── [email protected]  deduped
└── [email protected] 

look like this:

[email protected] /home/me/myproject
└── [email protected] 

Please advise me on how to do that.

It is also worth noting that in that previous question I had resolved global and local versions to be [email protected] but here I needed [email protected] to work with my ionic and angular versions.

2
  • To update: I ran npm dedupe, but this did not help the error. Commented Oct 14, 2022 at 0:12
  • I ended up upgrading to NodeJS 14 and it solved this problem. Of course I had to update my entire project with compatible packages (Angular, Ionic, etc.) which took a while. Commented Oct 21, 2022 at 17:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.