Hello!
Background: I’m not sure if this is an Ionic issue, NPM issue, issue with my configuration, or an Angular issue. By trade I’m a cloud / DevOps guy but Node and JavaScript are new to me. Any help with this issue would be hugely appreciated as it will teach me how to “fish for myself” in the future.
I was able to generate projects with “ionic start” in the past but now I’m getting ERESOLVE errors when trying to create a new Angular project. The only thing that may have changed on my system is npm / node which I update via Brew on my Mac laptop (Big Sur version).
My Node and NPM environments:
JoshTs-MacBook-Air:ionictmp josht$ npm --version
7.3.0
$ node --version
v15.5.0
$ npm ls -g
/usr/local/lib
├── @angular-devkit/build-angular@0.1100.5
├── @angular/compiler-cli@11.0.5
├── @angular/compiler@11.0.5
├── @capacitor/cli@2.4.5
├── @capacitor/core@2.4.5
├── @ionic/cli@6.12.3
├── cordova@10.0.0
├── follow-redirects@1.13.1
├── ionic@
├── npm-check-updates@10.2.5
├── npm@7.3.0
└── typescript@3.9.5
$ npm ls
josht@ /Users/josht
├── @capacitor/cli@2.4.5
├── @capacitor/core@2.4.5
├── @ionic/storage@2.3.1
└── npm-check-updates@10.2.5
JoshTs-MacBook-Air:ionictmp josht$ ionic --version
6.12.3
$ capacitor --version
2.4.5
$
When I “ionic start” with React or Vue things work fine and the project is created successfully.
When I try to “ionic start” any type of Angular project (besides my-first-app & conference) it fails with the following:
$ ionic start testproject blank --type angular
✔ Preparing directory ./testproject in 24.32ms
✔ Downloading and extracting blank starter in 419.27ms
? Integrate your new app with Capacitor to target native iOS and Android? No
Installing dependencies may take several minutes.
──────────────────────────────────────────────────────────────
Ionic Appflow, the mobile DevOps solution by Ionic
Continuously build, deploy, and ship apps 🚀
Focus on building apps while we automate the rest 🎁
👉 https://ion.link/appflow 👈
──────────────────────────────────────────────────────────────
> npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: testproject@0.0.1
**npm ERR! Found: typescript@4.0.5**
npm ERR! node_modules/typescript
npm ERR! peer typescript@">=3.9 <4.1" from @angular/compiler-cli@10.2.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@">=10.0.0-next.0 < 11" from @angular-devkit/build-angular@0.1000.8
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!
**npm ERR! Could not resolve dependency:**
**npm ERR! peer typescript@">=3.9 < 3.10" from @angular-devkit/build-angular@0.1000.8**
**npm ERR! node_modules/@angular-devkit/build-angular**
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/josht/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/josht/.npm/_logs/2020-12-24T21_12_48_169Z-debug.log
[ERROR] An error occurred while running subprocess npm.
npm i exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
$
In the package.json in the testproject directory I see in the DevDepenencies section:
"typescript": "~3.9.5"
Some things I tried:
- “npm update”
- npm cache clear --force
- The global version of typescript WAS 4.0.5 but I uninstall then re-install 3.9.5 but “npm i” still says it has found version 4.0.5
- Reboot (haha)
The question is this: Why does NPM think I have typescript@4.0.5 installed when “npm ls -g” is showing version 3.9.5?
I’m not sure what else to try at this point. Things used to work. I could rip out all of node and NPM and re-install it but that seems like overkill. I could downgrade the global NPM Angular packages to 10.x but to be candid I don’t remember if they were always 11.x or if they were upgraded to 11.x as part of my troubleshooting.
I’ve worked with dependencies before but I"m baffled.
Any help would be much appreciated.