Angular – npm ERR! notarget No matching version found for jasmine-core@~2.9.0

angular

I created a new angular application. But while doing npm install I am getting the below error. Is anyone came across this kind of issue?

Here is my Package.json content:
{
"name": "my-exp",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.1.2",
"@angular/cdk": "^5.0.4",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.4",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "^5.4.1",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "^1.6.4",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "^2.6.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~8.0.47",
"codelyzer": "~4.0.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.2.0",
"ts-node": "~3.3.0",
"tslint": "~5.8.0",
"typescript": "~2.6.1"
}
}

THis is the error

npm ERR! code ETARGET

npm ERR! notarget No matching version found for jasmine-core@~2.9.0

npm ERR! notarget In most cases you or one of your dependencies are requesting

npm ERR! notarget a package version that doesn't exist.

npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'jasmine'

npm ERR! notarget

npm ERR! A complete log of this run can be found in:

Best Answer

jasmine-core is a peerDependency it is not automatically installed from npm 3 on wards. You need to install it manually.

  1. Install locally: npm install jasmine-core --save-dev
  2. Check to make sure the installed version is the same as the version in package.json. Update the one in package.json if necessary.
  3. Do npm install.

OR if you are not using karma-jasmine in your project, simply remove jasmine-core from devDependencies in your package.json and do npm install. Build should be successful with a warning as in below:

npm WARN karma-jasmine@1.1.0 requires a peer of jasmine-core@* but none is installed. You must install peer dependencies yourself.

Related Topic