在我的 angular13 应用程序中安装 Angular Universal 失败

emm*_*mme 8 npm angular

我正在尝试在我的 Angular 13 应用程序中安装 @nguniversal/express-engine@13.0.1 但出现一些错误。有人可以帮助我吗?

Angular CLI:13.0.4 节点:16.13.1 包管理器:npm 8.1.2

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: gh-portfolio@0.0.0
npm ERR! Found: @angular/animations@13.0.3
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"~13.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/animations@"13.1.0" from @angular/platform-server@13.1.0
npm ERR! node_modules/@angular/platform-server
npm ERR!   peer @angular/platform-server@"^13.0.1" from @nguniversal/express-engine@13.0.1
npm ERR!   node_modules/@nguniversal/express-engine
npm ERR!     @nguniversal/express-engine@"13.0.1" 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! 
Run Code Online (Sandbox Code Playgroud)

Muh*_*din 9

试试这个,对我有用。

我按照步骤进行操作并能够实现相同的目标。

  1. 运行npm i @nguniversal/express-engine,如果抛出错误尝试使用 --force 运行。
  2. ng 生成通用 --project=<project_name>

有用的链接: