0

Whenever i m generating a project i am getting this error

command i tried: ng new dron (for generating the project)

error:

npm ERR! Found: postcss@8.2.14
npm ERR! node_modules/postcss
npm ERR!   postcss@"8.2.14" from @angular-devkit/build-angular@0.1102.13
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"~0.1102.13" from the root project
npm ERR!   peer postcss@"^8.1.0" from autoprefixer@10.2.4
npm ERR!   node_modules/autoprefixer
npm ERR!     autoprefixer@"10.2.4" from @angular-devkit/build-angular@0.1102.13
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"~0.1102.13" from the root project
npm ERR!   9 more (css-loader, cssnano, postcss-import, postcss-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer postcss@"^8.2.15" from cssnano-preset-default@5.1.1
npm ERR! node_modules/cssnano/node_modules/cssnano-preset-default
npm ERR!   cssnano-preset-default@"^5.0.1" from cssnano@5.0.2
npm ERR!   node_modules/cssnano
npm ERR!     cssnano@"5.0.2" from @angular-devkit/build-angular@0.1102.13
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"~0.1102.13" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
jeno
  • 62
  • 4

1 Answers1

0

Please check your nodejs version. I was facing the same issue. The nodejs version on my machine was v16.2.0. I changed it to v12.22.1. It's working now.

You can check the compatible version of node for particular angular version from here https://stackoverflow.com/a/60258560/9574445

To change the nodejs versions you can use nvm https://github.com/nvm-sh/nvm

Dharman
  • 30,962
  • 25
  • 85
  • 135
Darshan Devrai
  • 566
  • 5
  • 10