angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

NG Update 9.0 (please help)

Open CieloVistaSoftware opened this issue 6 years ago • 18 comments

🐞 Bug report

  • [ ] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [x ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Description

When using NG Update which we've been doing for many different solutions for quite a while now, we find these types of issues.

The Global and Dev environments will be out of sync. Perhaps the Global will make it to 9 but often we have to handhold the Dev updates using NPM Install which even when specifying the exact same version and a component in Global, doesn't exactly match that version. A good example was all Globals reached 9.0.1 but dev versions went to 9.0.2.

NG Update seems to bypass the Angular/CLI itself. This forces another NPM install to sync up dev and global.

🔬 Minimal Reproduction

Create a new ASP.NET 31 Angular solution and try NG Update

We are running on a Windows 10 environment with latest Node and NPM. We have tried installing Angular/Cli@latest to start, we have just used the Angular/Cli around version 8.... Things do not go smooth.

CieloVistaSoftware avatar Mar 24 '20 16:03 CieloVistaSoftware

ng update from angular 8.2.14 shows these errors:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})        
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})        
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\@angular\compiler-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})        
npm WARN @fortawesome/[email protected] requires a peer of @angular/common@^6.0.0 || ^7.0.0 but none was installed.
npm WARN @fortawesome/[email protected] requires a peer of @angular/core@^6.0.0 || ^7.0.0 but none was installed.
npm WARN @ng-select/[email protected] requires a peer of @angular/common@>=6.0.0 <8.0.0 but none was installed.
npm WARN @ng-select/[email protected] requires a peer of @angular/core@>=6.0.0 <8.0.0 but none was installed.
npm WARN @ng-select/[email protected] requires a peer of @angular/forms@>=6.0.0 <8.0.0 but none was installed.
npm WARN [email protected] requires a peer of [email protected] - 3 but none was installed.
npm WARN [email protected] requires a peer of popper.js@^1.16.0 but none was installed.

CieloVistaSoftware avatar Mar 24 '20 16:03 CieloVistaSoftware

Where's Angular 9? did it fail because of the errors above? After the update ng --version shows this:

Angular CLI: 8.3.25
Node: 12.14.1
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.25
@angular-devkit/build-angular     0.803.25
@angular-devkit/build-optimizer   0.803.25
@angular-devkit/build-webpack     0.803.25
@angular-devkit/core              8.3.25
@angular-devkit/schematics        8.3.25
@angular/cdk                      8.2.3
@angular/cli                      8.3.25
@angular/material                 8.2.3
@ngtools/webpack                  8.3.25
@schematics/angular               8.3.25
@schematics/update                0.803.25
rxjs                              6.5.4
typescript                        3.5.3
webpack                           4.39.2

CieloVistaSoftware avatar Mar 24 '20 16:03 CieloVistaSoftware

If I type in 'ng update' again, thinking nothing really happened based on version above.

The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 58 dependencies.
    We analyzed your package.json, there are some packages to update:

      Name                                 Version                  Command to update
     ----------------------------------------------------------------------------------
      @angular/cdk                         8.2.3 -> 9.1.3           ng update @angular/cdk
      @angular/cli                         8.3.25 -> 9.0.7          ng update @angular/cli
      @angular/core                        8.2.14 -> 9.0.7          ng update @angular/core
      @angular/material                    8.2.3 -> 9.1.3           ng update @angular/material

This time is confirms the first update did nothing because now it's showing the from and to versions.

but.....

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

After typing in 'ng update @nagular/cdk' it thinks for a while and issues this:

- [ ] The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Repository is not clean. Please commit or stash any changes before updating.

My bad but not always the case as the first ng update will sometimes change a file, if I commit I'm able to easily run the update the second time.

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

Hi @Javaman2, the above are not errors but warnings are those are caused by incorrect project dependencies versions and because your ar running on Windows.

  • npm WARN xxx requires a peer of xxx The problem here is that your depedencies are not "compatable" Angular 8+. Example @fortawesome/[email protected] has a peer dependency on Angular 6 or 7. Same thing applies for other packages such as @ng-select/ng-select. Most likely you also need to update these dependencies.

  • npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents This occurs because fsevents is an optional dependency, and used only in a macOS environment, since you're running on Windows, fsevents is skipped as irrelevant.

  • npm WARN [email protected] requires a peer of xxx but none was installed This warning is because bootstrap has peer dependencies on popper.js and jquery but have not been installed in your project.

  • The installed Angular CLI version is older than the latest stable version This is because your project is not on the latest version of the Angular CLI version, ng update will always download a temporary version to run the ng update when Angular CLI is out of date. The main reason for this is so that the when doing ng update you always get the latest bug fixes and improvements related to ng update.

alan-agius4 avatar Mar 24 '20 17:03 alan-agius4

Ok I had been ignoring these dependency issues thinking exactly what you said is root cause. Now, why do I have to manually update these:

      Name                                 Version                  Command to update
     ----------------------------------------------------------------------------------
      @angular/cdk                         8.2.3 -> 9.1.3           ng update @angular/cdk
      @angular/cli                         8.3.25 -> 9.0.7          ng update @angular/cli
      @angular/core                        8.2.14 -> 9.0.7          ng update @angular/core
      @angular/material                    8.2.3 -> 9.1.3           ng update @angular/material

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

When I attempt to install the cdk manually....

The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 58 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular/material" has an incompatible peer dependency to "@angular/cdk" (requires "8.2.3", would install "9.1.3").
                  Package "@fortawesome/angular-fontawesome" has an incompatible peer dependency to "@angular/core" (requires "^6.0.0 || ^7.0.0" (extended), would install "9.0.7").
                  Package "@ng-select/ng-select" has an incompatible peer dependency to "@angular/forms" (requires ">=6.0.0 <8.0.0" (extended), would install "9.0.7").
                  Package "@fortawesome/angular-fontawesome" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0 || ^7.0.0" (extended), would install "9.0.7").
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.6", would install "3.7.5").
× Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.    
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.       
  See "C:\Users\John\AppData\Local\Temp\ng-4KpzrH\angular-errors.log" for further details.

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

Do I now need to reinstall angular/cdk, @angular/core and @angular/forms to what was once already there?

I'm thinking I should have to worry about any @angular modules/components as well as @fortawesome because they should all be a part of an update in my opionion. ng-select is 3rd party and not an issue.

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

When I perform this dependent install

npm install @angular/core@^6.00 

we see this new set of issues.

npm install @angular/core@^6.00 
[email protected] C:\mnlottery\Gavia\Gavia\Web\UI\Gavia-Spa
`-- (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\@angular\compiler-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/core@^8.0.0 || ^9.0.0-0 but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of zone.js@~0.8.26 but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/core@^8.0.0 || ^9.0.0-0 but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @fortawesome/[email protected] requires a peer of @angular/common@^6.0.0 || ^7.0.0 but none was installed.
npm WARN @ng-select/[email protected] requires a peer of @angular/common@>=6.0.0 <8.0.0 but none was installed.
npm WARN @ng-select/[email protected] requires a peer of @angular/forms@>=6.0.0 <8.0.0 but none was installed.
npm WARN @testing-library/[email protected] requires a peer of @angular/core@^8.0.0 but none was installed.
npm WARN [email protected] requires a peer of [email protected] - 3 but none was installed.
npm WARN [email protected] requires a peer of popper.js@^1.16.0 but none was installed.
npm WARN [email protected] requires a peer of @angular/core@^7.2.0 || ^8.0.0 but none was installed.
npm WARN [email protected] requires a peer of @angular/core@^8.0 but none was installed.

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

I'm getting deeper into dependency hell. This can go on for the entire day trying to "Get there"... to version 9.0 for both global and dev instances. Please advise.

CieloVistaSoftware avatar Mar 24 '20 17:03 CieloVistaSoftware

Installing dependencies manually ie: npm install @angular/core@^6.0.0 will undoubtedly cause errors and isn't recommended to been done as most likely you end up in a broken state.

This is because npm install will only update a single package and not all of the @angular/framework packages. Also code modes and migrations will not be executed.

Kindly follow the update guide https://update.angular.io/#8.0:9.0

alan-agius4 avatar Mar 24 '20 17:03 alan-agius4

Ok I went back and followed all instructions from your link above. Here's the latest error.

ng update @angular/core @angular/cli The installed Angular CLI version is older than the latest stable version. Installing a temporary version to perform the update. Installing packages for tooling via npm. Installed packages for tooling via npm. Using package manager: 'npm' Collecting installed dependencies... Found 58 dependencies. Fetching dependency metadata from registry... Package "@fortawesome/angular-fontawesome" has an incompatible peer dependency to "@angular/core" (requires "^6.0.0 || ^7.0.0" (extended), would install "9.0.7"). Package "@fortawesome/angular-fontawesome" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0 || ^7.0.0" (extended), would install "9.0.7"). Package "@ng-select/ng-select" has an incompatible peer dependency to "@angular/forms" (requires ">=6.0.0 <8.0.0" (extended), would install "9.0.7").

I thought angular-fontawesome was a part of angular? Should I take --force to get by these?

CieloVistaSoftware avatar Mar 24 '20 18:03 CieloVistaSoftware

When I use the --force option I see a message that the project updated. ng --version now shows:

Angular CLI: 9.0.7
Node: 12.14.1
OS: win32 x64

Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.25
@angular-devkit/build-angular     0.900.7
@angular-devkit/build-optimizer   0.900.7
@angular-devkit/build-webpack     0.900.7
@angular-devkit/core              9.0.7
@angular-devkit/schematics        9.0.7
@angular/cdk                      8.2.3
@angular/material                 8.2.3
@ngtools/webpack                  9.0.7
@schematics/angular               9.0.7
@schematics/update                0.900.7
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

CieloVistaSoftware avatar Mar 24 '20 18:03 CieloVistaSoftware

No, angular-fontawesome is not a first party project.

You seem to be directly depending on @angular-devkit/architect which shouldn't be needed unless you are developing builders.

Also, it seems that @angular/material was not updated, mostly likely you missed this step from the update guide. Please run ng update @angular/material.

alan-agius4 avatar Mar 24 '20 18:03 alan-agius4

Thanks for information... and help.

CieloVistaSoftware avatar Mar 24 '20 19:03 CieloVistaSoftware

Closing as there doesn’t seem to be a bug.

This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular-cli

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

alan-agius4 avatar Mar 24 '20 19:03 alan-agius4

Sorry I thought this was a bug for sure. OK to close

CieloVistaSoftware avatar Mar 24 '20 19:03 CieloVistaSoftware

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.