sachin kulkarni
sachin kulkarni

Reputation: 2828

jasmine version error while running ng new command

I am getting error while running ng new command below error is fired during the ng new Project-Name-Here

Could not resolve dependency: error peer jasmine-core@">=3.7.1" from [email protected]

silly fetch manifest jasmine-core@>=3.7.1
83 timing idealTree Completed in 8839ms
84 timing command:install Completed in 8849ms
85 verbose stack Error: unable to resolve dependency tree
85 verbose stack     at Arborist.[failPeerConflict] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1141:25)
85 verbose stack     at Arborist.[loadPeerSet] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1118:34)
85 verbose stack     at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:836:11)
85 verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:209:7)
85 verbose stack     at async Promise.all (index 1)
85 verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:130:5)
85 verbose stack     at async install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:38:3)
86 verbose cwd C:\Users\PYH0JFQ\source\Hospital\Patient
87 verbose Windows_NT 10.0.19041
88 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
89 verbose node v15.11.0
90 verbose npm  v7.6.0
91 error code ERESOLVE
92 error ERESOLVE unable to resolve dependency tree
93 error
94 error While resolving: [email protected]
94 error Found: [email protected]
94 error node_modules/jasmine-core
94 error   dev jasmine-core@"~3.6.0" from the root project
94 error
94 error Could not resolve dependency:
94 error peer jasmine-core@">=3.7.1" from [email protected]
94 error node_modules/karma-jasmine-html-reporter
94 error   dev karma-jasmine-html-reporter@"^1.5.0" from the root project
94 error
94 error Fix the upstream dependency conflict, or retry
94 error this command with --force, or --legacy-peer-deps
94 error to accept an incorrect (and potentially broken) dependency resolution.

Upvotes: 0

Views: 2152

Answers (2)

Jim Andersen
Jim Andersen

Reputation: 33

I found, what I feel is, a better solution. After running the ng new - go into package.json and simply change

"jasmine-core": "~3.7.0",

to

"jasmine-core": "~3.8.0",

and then run npm install afterwards.

Upvotes: 2

Sandeep Modak
Sandeep Modak

Reputation: 842

I have faced the same issue recently and i got to know this from an online instructor. you should have phrase the question neatly, anyways

This error is caused by an npm 7 issue. The Angular team recommends to use npm 6 for now. so downgrade the npm 7 to npm 6 for now

npm install -g npm@6

or

An alternative can be to run ng new with the --skipInstall flag, and then install the dependencies with npm install --legacy-peer-deps.

Upvotes: 11

Related Questions