8

I am trying to install @nguniversal/express-engine@13.0.1 in my angular 13 app but I get some errors. Anyone can help me?

Angular CLI: 13.0.4 Node: 16.13.1 Package Manager: 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! 
emme
  • 101
  • 2
  • 6

3 Answers3

9

Try this, worked for me.

I followed the steps and able to achieve the same.

  1. Run npm i @nguniversal/express-engine, if throws error try to run with --force.
  2. ng generate universal --project=<project_name>

Useful Links:

  • Thank you very much for the information, now the project is working. The links you shared are very useful! – emme Dec 25 '21 at 13:19
2

I had this problem too but the '--force' is not a good idea. So I think the ng wants to upgrade @angular/animations but it has peer dependencies with another angular modules. So I tried to update the whole angular project.

https://update.angular.io/

npx @angular/cli@13 update @angular/core@13 @angular/cli@13

Try to update your project with this code then you can install a new package with ng

achim2
  • 41
  • 1
  • 6
1

you need to code as below:

npm install @nguniversal/express-engine --legacy-peer-deps

After it will install node_modules but not required files. To do this:

ng add @nguniversal/express-engine

This will say "The package already installed". Ignore this and wait to see required SSR files.