Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

having jasmine error on npm install, angular4

Tags:

angular

I am trying to run npm install, on angular-4 project , it is giving me error,

My package.json is:

"devDependencies": {
    "@angular/compiler-cli": "^4.4.6",
    "@angular/language-service": "^4.4.6",
    "@compodoc/compodoc": "^1.1.6",
    "@types/jasmine": "^2.8.3",

and

"typescript": "~2.3.3" in dependencies.


ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,227): ':' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,47): ';' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,104): ']' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,112): ',' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,113): Property assignment expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,121): ')' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,147): '(' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,162): ']' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,163): ',' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,164): Property assignment expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,165): Property assignment expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,179): ',' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,183): ':' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,208): '{' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,217): ':' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,222): ',' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,90): '(' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,228): Expression expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,230): ')' expected.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,68): 'ReadonlyArray' only refers to a type, but is being used as a value here.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,92): The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,94): Cannot find name 'methodName'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,106): Cannot find name 'string'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,124): 'ReadonlyArray' only refers to a type, but is being used as a value here.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,149): The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,150): A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,151): Cannot find name 'P'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,156): Cannot find name 'keyof'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,162): Cannot find name 'T'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,180): Cannot find name 'P'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,217): Cannot find name 'T'.
ERROR in /home/infinity/CiscoGit/AS/AS-BAC-BPA/node_modules/@types/jasmine/index.d.ts (138,219): Cannot find name 'P'.
like image 471
raju Avatar asked Nov 06 '18 10:11

raju


3 Answers

You are using the following semver in your package.json for the @types/jasmine package:

"@types/jasmine": "^2.8.3"

The ^ implies that your package installer will download the latest minor version that's out there available for the said package, which in this case is 2.8.11. (If you visit https://www.npmjs.com/package/@types/jasmine you will notice that they released their latest version 2.8.11 20 hours ago.)

There are two ways to go about solving your problem: 1) Make sure your Typescript version is compatible with the @types/jasmine package 2) Lock down your version to a specific one (2.8.8 is fairly stable). Hope this helps!

like image 97
NeptuneOyster Avatar answered Nov 19 '22 10:11

NeptuneOyster


Try changing the @types/jasmine version to "@types/jasmine": "2.5.38" and reinstall.

Here you can find a long discussion about it.

like image 44
SeleM Avatar answered Nov 19 '22 09:11

SeleM


I got a similar error and locked the jasmine version to the latest working version, which for me was

"@types/jasmine": "2.8.9"

However, i ran into another issue because I am using karma-jasmine-html-reporter

https://www.npmjs.com/package/karma-jasmine-html-reporter

So I locked the version for this package as well to the latest working version, which for me was

"karma-jasmine-html-reporter": "1.3.1"

After these two changes the build was working again for me.

Be sure to remove the locks once another working version of jasmine and karma-jasmine-html-reporter comes out.

like image 25
GC268DM Avatar answered Nov 19 '22 08:11

GC268DM