1
votes

So we have a site we created last year using:

  • node v6.9.1
  • npm v3.10.8
  • angular-cli v1.0.0-beta.24
  • typescript v2.1.4

This app was able to build last time the previous developer checked in. Since getting a new developer, setting up the versions above and performing an ng build we are now getting new errors:

ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,74): ']' expected. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,75): ';' expected. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,76): Declaration or statement expected. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,104): Expression expected. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (29,120): ')' expected. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (29,155): '(' expected. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,62): A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,63): Cannot find name 'K'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,68): Cannot find name 'keyof'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,74): Cannot find name 'R'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,78): Cannot find name 'AsyncAutoTask'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,92): Cannot find name 'R'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,94): Cannot find name 'K'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,98): Cannot find name 'R'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (28,101): Cannot find name 'E'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (29,114): Cannot find name 'keyof'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (29,120): Cannot find name 'R'. ERROR in E:/code/score/node_modules/@types/async/index.d.ts (29,124): Cannot find name 'AsyncAutoTaskFunction'.`

Here are the dependencies and devDependencies sections of package.json: "dependencies": { "@angular/common": "^2.3.1", "@angular/compiler": "^2.3.1", "@angular/core": "^2.3.1", "@angular/forms": "^2.3.1", "@angular/http": "^2.3.1", "@angular/platform-browser": "^2.3.1", "@angular/platform-browser-dynamic": "^2.3.1", "@angular/router": "^3.3.1", "@types/file-saver": "0.0.0", "angular2-apollo": "^0.9.0-rc.3", "apollo-client": "^0.7.1", "azure-storage": "^2.1.0", "bootstrap-sass": "^3.3.7", "chart.js": "^2.5.0", "core-js": "^2.4.1", "file-saver": "^1.3.3", "graphql-tag": "^1.2.2", "hammerjs": "^2.0.8", "jquery": "^3.1.1", "ng2-bootstrap": "^1.4.0", "ng2-charts": "^1.5.0", "ng2-cookies": "^1.0.8", "rxjs": "^5.0.1", "ts-helpers": "^1.1.1", "zone.js": "^0.7.2" }, "devDependencies": { "@angular/compiler-cli": "^2.3.1", "@types/bootstrap": "^3.3.32", "@types/chai": "^3.4.34", "@types/isomorphic-fetch": "0.0.31", "@types/jasmine": "2.5.38", "@types/jquery": "^2.0.40", "@types/node": "^6.0.60", "angular-cli": "1.0.0-beta.24", "codelyzer": "~2.0.0-beta.1", "gulp": "3.9.1", "gulp-sourcemaps": "2.4.0", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "~4.0.13", "ts-node": "1.2.1", "tslint": "^4.0.2", "typed-graphql": "^1.0.2", "typescript": "~2.0.3" } The following is the output from npm outdated command: $ npm outdated Package Current Wanted Latest @angular/common 2.4.10 2.4.10 5.2.0 @angular/compiler 2.4.10 2.4.10 5.2.0 @angular/compiler-cli 2.4.10 2.4.10 5.2.0 @angular/core 2.4.10 2.4.10 5.2.0 @angular/forms 2.4.10 2.4.10 5.2.0 @angular/http 2.4.10 2.4.10 5.2.0 @angular/platform-browser 2.4.10 2.4.10 5.2.0 @angular/platform-browser-dynamic 2.4.10 2.4.10 5.2.0 @angular/router 3.4.10 3.4.10 5.2.0 @types/chai 3.5.2 3.5.2 4.1.0 @types/file-saver 0.0.0 0.0.0 1.3.0 @types/isomorphic-fetch 0.0.31 0.0.31 0.0.34 @types/jasmine 2.5.38 2.5.38 2.8.3 @types/jquery 2.0.48 2.0.48 3.2.17 @types/node 6.0.96 6.0.96 9.3.0 angular-cli 1.0.0-beta.24 1.0.0-beta.24 1.0.0-beta.28.3 apollo-client 0.7.3 0.7.3 2.2.0 codelyzer 2.0.1 2.0.1 4.0.2 graphql-tag 1.3.2 1.3.2 2.6.1 gulp-sourcemaps 2.4.0 2.4.0 2.6.3 jasmine-core 2.5.2 2.5.2 2.8.0 jasmine-spec-reporter 2.5.0 2.5.0 4.2.1 karma 1.2.0 1.2.0 2.0.0 karma-remap-istanbul 0.2.2 0.2.2 0.6.0 protractor 4.0.14 4.0.14 5.2.2 ts-node 1.2.1 1.2.1 4.1.0 tslint 4.5.1 4.5.1 5.9.1 typescript 2.0.10 2.0.10 2.6.2 zone.js 0.7.8 0.7.8 0.8.20

We are not sure how to resolve this issue as we have even tried updating node/npm/angular/typescript to other problems.

Any help/guidance/suggestions would be greatly appreciated.

1
Not every version of every package is compatible with every version of other packages. You'll need to dig into the documentation for each one and figure out what its peer dependencies are and what it supports. Package management is a pain, and must be done very carefully and strategically for this reason. Can you post your dependencies and devDependencies listed in your package.json file and possibly the output of npm outdated on the machine it is failing on?mhodges
You can try my answer in this question to see if it helps you stackoverflow.com/questions/48054005/…Hung Tran
Thanks @HT89, I had originally tried updating everything but that produced many more incompatibilities throughout the working code. When we pulled down the code that was working and hadn't changed since the last successful deployment it would just give us the errors above.Jeff L8
Thanks @mhodges, I have edited the question to include the information you wanted to see.Jeff L8
@JeffL8 I see that typescript 2.0.10 is listed in your npm outdated output, however you said that you're using 2.1.4. Can you clarify this discrepancy for me? Also, for future reference, putting ~ and ^ in your dependencies lists is a really bad idea for this very reason. You're not guaranteed the same version of the packages each time you npm install and therefore you can run into version conflictsmhodges

1 Answers

0
votes

So after going through many versions of TypeScript (e.g. 2.0.10, 2.1.4 and the latest; 2.6.2) we stumbled upon a 2.1 (no revision, just major.minor: "typescript": "2.1") that resolved the build. We found this odd but didn't fight it, made the change, checked it in and watched the CI/CD complete successfully.