PS F:\Web_Study\AngularJS> ng new project ? Would you like to add Angular routing? Yes ? Which stylesheet format would you like to use? SCSS [ https://sass-lang.com/documentation/syntax#scss ] CREATE project/angular.json (3213 bytes) CREATE project/package.json (1071 bytes) CREATE project/README.md (1053 bytes) CREATE project/tsconfig.json (863 bytes) CREATE project/.editorconfig (274 bytes) CREATE project/.gitignore (620 bytes) CREATE project/.browserslistrc (600 bytes) CREATE project/karma.conf.js (1424 bytes) CREATE project/tsconfig.app.json (287 bytes) CREATE project/tsconfig.spec.json (333 bytes) CREATE project/src/favicon.ico (948 bytes) CREATE project/src/index.html (293 bytes) CREATE project/src/main.ts (372 bytes) CREATE project/src/polyfills.ts (2338 bytes) CREATE project/src/styles.scss (80 bytes) CREATE project/src/test.ts (745 bytes) CREATE project/src/assets/.gitkeep (0 bytes) CREATE project/src/environments/environment.prod.ts (51 bytes) CREATE project/src/environments/environment.ts (658 bytes) CREATE project/src/app/app-routing.module.ts (245 bytes) CREATE project/src/app/app.module.ts (393 bytes) CREATE project/src/app/app.component.html (23364 bytes) CREATE project/src/app/app.component.spec.ts (1076 bytes) CREATE project/src/app/app.component.ts (212 bytes) CREATE project/src/app/app.component.scss (0 bytes) ⠴ Installing packages (npm)...npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: project@0.0.0 npm ERR! Found: @angular/core@13.0.0 npm ERR! node_modules/@angular/core npm ERR! @angular/core@"~13.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/core@"13.0.1" from @angular/animations@13.0.1 npm ERR! node_modules/@angular/animations npm ERR! @angular/animations@"~13.0.0" 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. npm ERR! npm ERR! See D:\Devoloper\Dev\Nodejs\node_cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! D:\Devoloper\Dev\Nodejs\node_cache\_logs\2021-11-12T16_22_03_498Z-debug.log ✖ Package install failed, see above. The Schematic workflow failed. See above.
运行命令:
npm install --legacy-peer-deps
对于angular错误来说,可以先
ng new my-project --skip-install
然后
cd my-project npm install