'Error: node_modules/@types/d3-dsv/index.d.ts(159,60): error TS1005: ',' expected
To solve an npm error in anular project, delete the node modules in the angular project, reinstall the npm modules and run ng serve, the follwing error occur. How can it be solved?
Error: node_modules/@types/d3-dsv/index.d.ts(159,60): error TS1005: ','expected.
node_modules/@types/d3-dsv/index.d.ts(159,61): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(169,64): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(169,65): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(186,46): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(186,52): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(186,54): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(195,44): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(195,50): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(300,60): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(300,61): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(310,64): error TS1005: ',' expected.
node_modules/@types/d3-dsv/index.d.ts(310,65): error TS1005: ',' expected.
My package.json - devDependencies
`
"devDependencies": {
"@angular/cli": "^1.7.4",
"@angular/compiler-cli": "6.1.9",
"@angular/language-service": "6.1.9",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/jquery": "~3.2.16",
"@types/node": "6.14.10",
"codelyzer": "^4.5.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-sonarqube-unit-reporter": "0.0.23",
"karma-spec-reporter": "0.0.32",
"merge-stream": "^1.0.1",
"protractor": "~5.1.2",
"requirejs": "^2.3.6",
"sonar-scanner": "^3.1.0",
"ts-mockito": "^2.3.0",
"ts-node": "~4.1.0",
"tslint": "5.20.1",
"typescript": "2.9.2"
}
Solution 1:[1]
Please make sure you're using TS of at least 2.8
Check your typescript version using
tsc -v
If it's less than 2.8 upgrade it with following command.
npm install -g typescript@latest
Please let me know if this works.
Solution 2:[2]
it's typescript compiler problem. just replace 'let' with 'var' then error disappear. but it is not a proper solution.
Solution 3:[3]
I needed to update my d3 types dependency. In my package.json I now use:
"@types/d3": "^7.1.0",
Then npm install. Previously I was using version 5.7.1, which gave that error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kartik Dolas |
| Solution 2 | joey |
| Solution 3 | user1689987 |
