简体   繁体   中英

Angular 7 ERROR in node_modules/graphql-tag/lib/index.d.ts(2,57): error TS1005: ',' expected

Hi I am facing issue while running ng serve command. My package.json file is

{
"name": "Myapp",
"version": "7.0.0",
"scripts": {
    "ng": "ng",
    "local-dev": "ng serve --progress --port 4200",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
},
"private": true,
"dependencies": {
    "@angular/animations": "7.1.0",
    "@angular/cdk": "7.1.0",
    "@angular/common": "7.1.0",
    "@angular/compiler": "7.1.0",
    "@angular/core": "7.1.0",
    "@angular/flex-layout": "7.0.0-beta.19",
    "@angular/forms": "7.1.0",
    "@angular/http": "7.1.0",
    "@angular/material": "7.1.0",
    "@angular/platform-browser": "7.1.0",
    "@angular/platform-browser-dynamic": "7.1.0",
    "@angular/router": "7.1.0",
    "@ngx-translate/core": "11.0.1",
    "@ngx-translate/http-loader": "4.0.0",
    "apollo-angular": "^1.5.0",
    "apollo-angular-link-http": "^1.5.0",
    "apollo-cache-inmemory": "^1.4.3",
    "apollo-client": "^2.4.13",
    "bootstrap": "^4.3.1",
    "buffer": "^5.2.1",
    "chart.js": "^2.7.3",
    "classlist.js": "^1.1.20150312",
    "core-js": "2.5.7",
    "docx": "^4.7.1",
    "docxtemplater": "^3.9.9",
    "file-saver": "^2.0.1",
    "fs": "0.0.1-security",
    "graphql": "^14.1.1",
    "graphql-code-generator": "^0.17.0",
    "graphql-tag": "^2.10.1",
    "hammerjs": "^2.0.8",
    "moment": "^2.24.0",
    "moment-range": "^4.0.2",
    "msal": "^0.2.4",
    "ng2-charts": "1.6.0",
    "ngx-bootstrap": "^3.3.0",
    "ngx-editor": "^4.1.0",
    "ngx-quill": "^7.3.2",
    "node-sass": "^4.13.1",
    "quill": "^1.3.7",
    "rxjs": "6.3.3",
    "web-animations-js": "^2.3.1",
    "zone.js": "0.8.26"
},
"devDependencies": {
    "@angular-devkit/build-angular": "0.10.6",
    "@angular/cli": "7.0.6",
    "@angular/compiler-cli": "7.1.0",
    "@angular/language-service": "7.1.0",
    "@types/jasmine": "3.3.0",
    "@types/jasminewd2": "2.0.6",
    "@types/node": "10.12.10",
    "codelyzer": "4.5.0",
    "jasmine-core": "3.3.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "3.1.1",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.4",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.0",
    "protractor": "5.4.1",
    "ts-node": "7.0.1",
    "tslint": "5.11.0",
    "typescript": "3.1.1"
}

}

WHile running ng serve i get this

ERROR in node_modules/graphql-tag/lib/index.d.ts(2,57): error TS1005: ',' expected. node_modules/graphql-tag/lib/index.d.ts(2,63): error TS1005: ',' expected. i 「wdm」: Failed to compile.

Below is the screenshot of the error message. Please help me out in solving. Thank you In advance!!

在此处输入图像描述

I'm pretty sure that is a dependency problem.

Your angular project is really out of date (take a look at this page https://angular.io/guide/releases#support-policy-and-schedule ) you should probably take time to bump it to latest version. I recommand bumping your dependencies version too. You are using angular-apollo v1.5 which is very old and may be incompatible with your current graphql-tag. It's hard to debug an outdated environment if you haven't hard-locked dependencies version.

Use ng update , npm outdated and npm update to make your project as up to date as possible. Maybe remove your node_modules and package-lock.json and run npm install to be sure that you have a proper dev environment.

Without a stackblitz or a github repo, it will be hard to help you more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM