nstudio / xplat

Cross-platform (xplat) tools for Nx workspaces.
MIT License
366 stars 52 forks source link

generate ionic app gets angular-toolkit conflict 3.1.1 vs 3.1.0 from NX root #261

Closed wstidolph closed 3 years ago

wstidolph commented 3 years ago

Freshly updated Ubuntu 20.10 under WSL2; fresh NX v12.0.8 workspace; fresh XPLAT 12.0.1 install in workspace.

Create first app (ionic, all defaults), get: ...

npm ERR! Could not resolve dependency:
npm ERR! peer @angular-devkit/build-angular@"^0.1102.4" from @ionic/angular-toolkit@3.1.1
npm ERR! node_modules/@ionic/angular-toolkit
npm ERR!   dev @ionic/angular-toolkit@"^3.1.0" from the root project

Full session:

░▒▓ ~/dev ▓▒░ npx create-nx-workspace@latest                                          ░▒▓ ✔ │ base Py │ at 16:25:56 ▓▒░
Need to install the following packages:
  create-nx-workspace@latest
Ok to proceed? (y) y
✔ Workspace name (e.g., org name)     · vidcomp
✔ What to create in the new workspace · empty
✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

>  NX  Nx is creating your workspace.

  To make sure the command works reliably in all environments, and that the preset is applied correctly,
  Nx will run "npm install" several times. Please wait.

>  NX   SUCCESS  Nx has successfully created the workspace.

░▒▓ ~/dev ▓▒░ cd vidcomp                                                ░▒▓ ✔ │ took 1m 37s │ base Py │ at 16:28:02 ▓▒░
░▒▓ ~/d/vidcomp │ on master ▓▒░ ls                                                    ░▒▓ ✔ │ base Py │ at 16:28:53 ▓▒░
README.md  libs          nx.json            package.json  tsconfig.base.json
apps       node_modules  package-lock.json  tools         workspace.json
░▒▓ ~/d/vidcomp │ on master ▓▒░ git status                                          ░▒▓ 1 ✘ │ base Py │ at 16:28:59 ▓▒░
On branch master
nothing to commit, working tree clean
░▒▓ ~/d/vidcomp │ on master ▓▒░ npm i @nstudio/xplat -D                               ░▒▓ ✔ │ base Py │ at 16:29:05 ▓▒░

added 49 packages, and audited 257 packages in 8s
...
[2021-05-02T23_32_40_344Z-debug.log](https://github.com/nstudio/xplat/files/6412449/2021-05-02T23_32_40_344Z-debug.log)

░▒▓ ~/d/vidcomp │ on master ▓▒░ git checkout -b appgentest                            ░▒▓ ✔ │ base Py │ at 16:30:11 ▓▒░
Switched to a new branch 'appgentest'
░▒▓ ~/d/vidcomp │ on appgentest ▓▒░ nx g app                                          ░▒▓ ✔ │ base Py │ at 16:30:44 ▓▒░
✔ What name would you like for this app? · tester
✔ What type of app would like to create? · ionic
✔ In which directory should the app be generated? (Just press Enter for the default: directly in 'apps') ·
✔ Would you like to configure routing for this app? (Y/n) · true
✔ Packages installed successfully.
Note to VS Code users: no development mode set. xplat could not find any VS Code settings in the standard location: /var/local/Code/User/settings.json It's possible you don't have a user settings.json yet. If so, open VS Code User settings and save any kind of setting to have it created.
⠹ Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vidcomp@0.0.0
npm ERR! Found: @angular-devkit/build-angular@0.1101.2
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"~0.1101.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular-devkit/build-angular@"^0.1102.4" from @ionic/angular-toolkit@3.1.1
npm ERR! node_modules/@ionic/angular-toolkit
npm ERR!   dev @ionic/angular-toolkit@"^3.1.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 /home/wstidolph/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/wstidolph/.npm/_logs/2021-05-02T23_32_40_344Z-debug.log (ATTACHED)
✖ Package install failed, see above.
NathanWalker commented 3 years ago

@wstidolph thanks, this is related to npm 7 new peer dependency handling. I've published 12.0.2 of the xplat schematics now. If you could bump all @nstudio devDependencies in your workspace to 12.0.2 (or if using ~12.0.0 should be fine).

Also check your @angular-devkit/build-angular version in your root package.json and make sure it's set to at least:

"@angular-devkit/build-angular": "~0.1102.0",

Then do a npx rimraf node_modules package-lock.json) and then reinstall (using yarn install or npm install --legacy-peer-deps) when you can, please let me know if it clears it for you.

wstidolph commented 3 years ago

Your suggested fix worked for my existing workspace. I also deleted the workspace and started over, and successfully created an ionic app. Thanks!