angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

'ng update @angular/cli' throws 'no elements in sequence' error #10965

Closed micobarac closed 6 years ago

micobarac commented 6 years ago

Versions

Angular CLI: 6.0.3
Node: 9.8.0
OS: darwin x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.3
@angular-devkit/core         0.6.3
@angular-devkit/schematics   0.6.3
@angular/cdk                 5.2.5
@angular/cli                 6.0.3
@angular/flex-layout         5.0.0-beta.14
@angular/material            5.2.5
@schematics/angular          0.6.3
@schematics/update           0.6.3
rxjs                         5.5.11
typescript                   2.8.3

Repro steps

I followed the official update guide on Angular Update Guide:

Observed behavior

ERROR: no elements in sequence

Btw, ng update throws the same error message with any dependency mentioned in update guide:

ng update @angular/core - ERROR: no elements in sequence ng update @angular/material - ERROR: no elements in sequence ng update - ERROR: no elements in sequence

The same error gets thrown even with a new Angular 6 project generated with:

ng new ng6 ng update - ERROR: no elements in sequence

When I downgraded Angular Cli from 6.0.3, which is the latest, to version 6.0.0, ng update @angular/cli worked well, with no errors.

The problem is that with version 6.0.0 ng update @angular/core throws an error:

Invalid range: ">=2.3.0 <3.0.0||>=4.0.0"

And there we are again in a magical loop of versions, which do not work as they should!

Any version higher than 6.0.0 is throwing the no elements in sequence error!

Desired behavior

Updated Angular Cli and other dependencies.

Mention any other details that might be useful (optional)

package.json contents:

{
  "name": "myapp",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --verbose -o --proxy-config=proxy.config.json",
    "build": "ng build --prod --bh /myapp/",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.8",
    "@angular/cdk": "^5.2.0",
    "@angular/common": "^5.2.8",
    "@angular/compiler": "^5.2.8",
    "@angular/core": "^5.2.8",
    "@angular/flex-layout": "^5.0.0-beta.13",
    "@angular/forms": "^5.2.8",
    "@angular/http": "^5.2.8",
    "@angular/material": "^5.2.0",
    "@angular/platform-browser": "^5.2.8",
    "@angular/platform-browser-dynamic": "^5.2.8",
    "@angular/router": "^5.2.8",
    "@covalent/core": "^1.0.0",
    "@covalent/dynamic-forms": "^1.0.0",
    "@covalent/highlight": "^1.0.0",
    "@covalent/http": "^1.0.0",
    "@covalent/markdown": "^1.0.0",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "chart.js": "^2.7.2",
    "chartjs-plugin-annotation": "^0.5.7",
    "codelyzer": "^4.1.0",
    "core-js": "^2.5.3",
    "file-saver": "^1.3.3",
    "hammerjs": "^2.0.8",
    "moment": "^2.22.1",
    "ng2-charts": "^1.6.0",
    "rxjs": "^5.5.6",
    "ts-node": "^4.1.0",
    "tslint": "^5.9.1",
    "typescript": "^2.7.2",
    "zone.js": "^0.8.20"
  },
  "devDependencies": {
    "@angular/cli": "^6.0.3",
    "@angular/compiler-cli": "^5.2.8",
    "@angular/language-service": "^5.2.8",
    "@types/jasmine": "~2.6.0",
    "@types/node": "~8.0.32",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "~1.3.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "~0.2.2",
    "protractor": "~5.1.2"
  }
}
CaselIT commented 6 years ago

Same error here. My versions:

Angular CLI: 6.0.3
Node: 8.11.2
OS: win32 x64
Angular: 6.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.3
@angular-devkit/build-angular     0.6.3
@angular-devkit/build-optimizer   0.6.3
@angular-devkit/core              0.6.3
@angular-devkit/schematics        0.6.3
@angular/cli                      6.0.3
@ngtools/webpack                  6.0.3
@schematics/angular               0.6.3
@schematics/update                0.6.3
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.8.3

I've also tried with node version 10.1 and 10.2 with the same result

micobarac commented 6 years ago

I managed to convert Angular 5.2 project to Angular 6 project following these steps:

Update Angular Cli (important for updating angular-cli.json to angular.json):

yarn install @anguar/cli@6.0.0
ng update @angular/cli

ng update fails with other @angular/* dependencies, due to obvious bugs in **Angular Cli 6.***

*Update `@angular/` and other dependencies manually**:

yarn global add npm-check-updates
ncu -u
yarn install

If any dependency inside package.json is not detected by ncu for update, update it manually.

After that, proceed with Angular Update Guide.

trojanc commented 6 years ago

The above did not work for me, all packages updated to 6.0.3, but still same error

Angular CLI: 6.0.3
Node: 8.11.1
OS: win32 x64
Angular: 6.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.3
@angular-devkit/core         0.6.3
@angular-devkit/schematics   0.6.3
@schematics/angular          0.6.3
@schematics/update           0.6.3
rxjs                         6.2.0
typescript                   2.8.3
ng update @angular/cli
no elements in sequence
micobarac commented 6 years ago

That's the problem, ng update @angular/cli won't work, if your current CLI version is higher that 6.0.0. Only 6.0.0 can perform ng update @angular/cli successfully. Versions 6.0.1, 6.0.2 and latest 6.0.3 won't work.

clydin commented 6 years ago

Is npm installed on the system?

CaselIT commented 6 years ago

@clydin not in my case, but I've the option

"cli": {
    "packageManager": "yarn"
  },

in the angular.json file

I can try to install it and report back

CaselIT commented 6 years ago

@clydin I've finally come around at trying. Installing npm does remove the error so it seem connected to that. Removed npm and the error came back

Maybe a better error message is needed.

clydin commented 6 years ago

This should be resolved with 6.0.7. Can you give it a try?

CaselIT commented 6 years ago

I've tried it and seems that version 6.0.7 does indeed fix the problem. Update now works without npm installed.

Thanks for fixing it!

My configuration

Angular CLI: 6.0.7
Node: 8.11.2
OS: win32 x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.3
@angular-devkit/build-angular     0.6.3
@angular-devkit/build-optimizer   0.6.3
@angular-devkit/core              0.6.3
@angular-devkit/schematics        0.6.3
@angular/cdk                      6.2.0
@angular/cli                      6.0.7
@angular/material                 6.2.0
@ngtools/webpack                  6.0.3
@schematics/angular               0.6.7
@schematics/update                0.6.7
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.8.3
clydin commented 6 years ago

Closing as resolved.

angular-automatic-lock-bot[bot] commented 5 years ago

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.