Tuesday, 6 November 2018

Angular 4+ : Sudden @types/jasmine error at runtime (npm start)

We've been building our angular application on a day to day basis, as everyone should. :-P Then, suddenly the following error surfaced on our Development Pipeline on Jenkins:

chunk {styles} styles.js, styles.js.map (styles) 201 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 332 kB [initial] [rendered]

ERROR in node_modules/@types/jasmine/index.d.ts(138,47): error TS1005: ';' expected.
node_modules/@types/jasmine/index.d.ts(138,90): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,104): error TS1005: ']' expected.

node_modules/@types/jasmine/index.d.ts(138,112): error TS1005: ',' expected.

We did not change any versions or anything (didn't touch package.json), except for typescript logic as part of development progress.

At the end of the day, this error occurred due to @types/jasmine publishing a new version. ALSO, we had the following configured in our package.json under the "devDependencies" section:

"@types/jasmine": "^2.8.6",
"@types/jasminewd2": "^2.0.3"

Removal of the caret '^' character resolved the issue.

So, in other words, because we had the caret character against the versions of:

  • @types/jasmine
  • @types/jasminewd2
...it made it vulnerable to subsequent publication of versions from @types/jasmine.

Hence, I've noted it here... :-)

PS: For the record, short explanation of menaing of '~' and '^' character in package.json file:

  • '^' - It will update you to the most recent MAJOR version 
  • '~' - It will update you to the most recent MINOR version 

No comments:

Post a Comment