离子服务失败,出现打字稿错误

时间:2019-10-29 04:34:03

标签: angular typescript ionic-framework

我有一个基本的Ionic应用程序,正在使用Firebase和Firestore作为Auth和DB开发。我在Windows和MacOS计算机上也遇到了同样的问题,而我的朋友在MacOS计算机上也遇到了同样的问题。此外,通过我们自己的代码库以及使用相似的设置(Ionic + Firebase)克隆git repo时,都会出现此问题。

在environment.ts文件中添加了Firebase信息并添加了Firebase程序包之后,我们运行Ionic Serve并始终出现相同的TS1005错误。

我们已经将Typescript回滚到3.4.3。我们最初有3.6.4,但是发现需要3.5.0以下版本的依赖项。

我们已经将Node更新到版本12,并尝试了NPM安装和更新,以确保我们拥有正确的软件包。

下面是我们的Packages.json:

{
  "name": "appname",
  "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/common": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/fire": "^5.2.1",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^4.7.1",
    "core-js": "^2.5.4",
    "firebase": "^7.2.2",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "~0.801.2",
    "@angular-devkit/core": "~8.1.2",
    "@angular-devkit/schematics": "~8.1.2",
    "@angular/cli": "8.1.3",
    "@angular/compiler": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@ionic/angular-toolkit": "~2.0.0",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "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": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project"
}

我们希望Ionic Serve命令可以在浏览器中加载应用程序。我们在终端中收到以下错误:

[ng] ERROR in src/environments/environment.prod.ts:3:3 - error TS1005: ',' expected.
[ng] 3   firebaseConfig: {
[ng]     ~~~~~~~~~~~~~~
[ng] src/environments/environment.prod.ts:12:4 - error TS1005: ',' expected.
[ng] 12   };
[ng]       ~
[ng] src/environments/environment.ts:7:3 - error TS1005: ',' expected.
[ng] 7   firebaseConfig: {
[ng]     ~~~~~~~~~~~~~~
[ng] src/environments/environment.ts:16:4 - error TS1005: ',' expected.
[ng] 16   };
[ng]       ~
[ng]

0 个答案:

没有答案