My-first-app starter npm update not working

hey guys,

i ran into update issues (as I am doing so often) and I thought it would be a wise idea to start fresh with an ionic starter app.

so I did ionic start and chose angular and the my-first-app
after everything went through I did
npm update (to see if that would work with a blank new starter)

and it crashed

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: photo-gallery-ng-capacitor@2.0.0
npm ERR! Found: typescript@3.9.7
npm ERR! node_modules/typescript
npm ERR!   dev typescript@"^3.8.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=3.6 <3.9" from @angular/compiler-cli@9.1.12
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"^9.1.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! 
npm ERR! See /Users/henningjaeger/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/henningjaeger/.npm/_logs/2020-11-23T07_50_58_306Z-debug.log

expectation:
a brand new starter app should not run into an npm update error (whatsoever)

Aside my expectation, I realise that I might just be to bold or naive here, so if anyone has a hint on where to learn how to avoid these topics I would be most grateful. I guess I am not really getting the topic dependency management that deep :frowning:
currently with my working apps I already try to not update anything because in 99% of my tries it always breaks everything :frowning:
there must be a better way - at least I hope

Can you elaborate a bit more on the exact steps and commands you took to hit this issue? Are you using a fresh app or a cloned version of first app angular?

I tried an npm update and it worked.

What version of Node and npm are you on (node -v and npm -v) and have you updated to the latest Ionic CLI (npm i -g @ionic/cli)?

Hey Matt!
So nice of you to attend to this, thank you, I am sure there are a lot more pressing matters out so, I appreciate that!

To your question:
My exakt steps

  • ionic start
  • chose angular
  • chose project name
  • chose my-first-app starter
  • cd into project
  • hit ionic serve -> works!
  • tried npm update -> error (see above)

ionic info

Ionic:

   Ionic CLI                     : 6.12.1 (/Users/henningjaeger/.nvm/versions/node/v15.0.1/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.7
   @angular-devkit/build-angular : 0.901.1
   @angular-devkit/schematics    : 9.1.1
   @angular/cli                  : 9.1.1
   @ionic/angular-toolkit        : 2.2.0

Capacitor:

   Capacitor CLI   : 2.0.1
   @capacitor/core : 2.0.1

Utility:

   cordova-res (update available: 0.15.2) : 0.15.1
   native-run                             : 1.2.2

System:

   NodeJS : v15.0.1 (/Users/henningjaeger/.nvm/versions/node/v15.0.1/bin/node)
   npm    : 7.0.3
   OS     : macOS Catalina

I’m not an expert but apparently it’s a problem with npm >v7. I had the same issue and I fixed it running the same command with the --legacy-peer-deps option.

1 Like

tried the --legacy-peer-deps option but it did not work for me, figured it was a problem with npm so I used yarn instead, that fixed it for me

1 Like