Skip to content

Package undefined not found error when updating to @angular/cli 6.0.0-rc.0 #10167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benjamincombes opened this issue Apr 4, 2018 · 9 comments
Assignees
Milestone

Comments

@benjamincombes
Copy link

benjamincombes commented Apr 4, 2018

Versions

Angular CLI: 6.0.0-rc.0
Node: 8.11.1
OS: darwin x64
Angular: 6.0.0-rc.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.2.4
@angular/cli: 6.0.0-rc.0
@angular/material: 5.2.4
@angular-devkit/architect: 0.5.0
@angular-devkit/core: 0.5.0
@angular-devkit/schematics: 0.5.0
@ngtools/json-schema: 1.1.0
@schematics/angular: 0.5.0
@schematics/update: 0.5.0
typescript: 2.7.2
webpack: error

Repro steps

  • Open an existing project
  • Update to angular 6.0.0-rc.0 and to @angular/cli 6.0.0-rc.0
  • Try to run the app, and get this error message :
An old project has been detected, which needs to be updated to Angular CLI 6.

Please run the following commands to update this project.

  ng update @angular/cli --migrate-only --from=1.7.1
  npm i
  • Run the required command

Observed behavior

The following error message is displayed:

Package undefined was not found in package.json.

Desired behavior

App should be updated succesfully.

@zackarychapple
Copy link
Contributor

zackarychapple commented Apr 4, 2018

I've started digging into this a bit and found its an error thrown by the schematic here, https://github.com/angular/devkit/blob/master/packages/schematics/update/update/index.ts#L393

After further investigation I found this is due to private / packages that are installed via git rather than npm's repository. When I removed the modules stored in Artifactory and the modules in github the update passed without issue.
https://github.com/angular/devkit/blob/master/packages/schematics/update/update/npm.ts#L28

@benjamincombes do you have private packages?

@benjamincombes
Copy link
Author

Hi @zackarychapple, thanks a lot for your answer! Yes, I'm using Verdaccio (https://github.com/verdaccio/verdaccio) to publish private packages used in all my projects.
Do you have any clue of wether this issue will be possible to fix without having to stop using private packages?

@hansl
Copy link
Contributor

hansl commented Apr 4, 2018

Seems like update is not compatible with private packages. The normal update flow might be a problem but we should be able to fix the migration one.

@aboodz
Copy link

aboodz commented Apr 5, 2018

just a little addition on @zackarychapple, even if you have a private package on an internal, or private, npm registry, you'll get the same error. The only dirty workaround is to remove private dependencies, execute the update, and then re add your dependencies again.

error is still in 6.0.0-rc.1

@hansl hansl self-assigned this Apr 5, 2018
@manfredsteyer
Copy link
Contributor

manfredsteyer commented Apr 7, 2018

What do you think about just providing a parameter --registry to point to a custom registry? We could also store a default value for this somewhere. Even though this solution isn't perfect (b/c, in theory, everyone could locally configure several registries for several scopes) it would be easy to implement and it should be suitable for the majority of cases.

I've also tried to spawn a process for npm info to get the semantics of npm (searching and respecting different .npmrc files, etc.) but this is very slow and we would need to call it for each and every dependency.

What do you think?

@zackarychapple
Copy link
Contributor

@manfredsteyer that would not resolve the issue because not all the packages are necessarily on the private repository. Sometimes it's prefixed packages @cb are in private. I think we should look at the following when deciding to upgrade.

  • is the version a URL already
  • try to hit npm, if 404 then assume private and don't try to upgrade

@manfredsteyer
Copy link
Contributor

@zackarychapple You are right. I like your solution and I would be happy to have an additional --registry flag as an further fallback to cover additional use cases. It would be really cool to get the option to use/ to test ng update with a private registry.

@playground
Copy link

playground commented May 11, 2018

Hi, I'm getting the same error when try to update from 1.6.3 to either 6.0.0 or 6.0.1 with the following commands:

ng update @angular/cli --migrate-only --from=1.6.3 or ng update @angular/cli

Node: 9.4.0
OS: darwin x64
Angular: 5.2.6
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.0
@angular-devkit/core         0.6.0
@angular-devkit/schematics   0.6.0
@angular/cdk                 5.2.3
@angular/cli                 6.0.0
@angular/material            5.2.3
@schematics/angular          0.6.0
@schematics/update           0.6.0
rxjs                         5.5.6
typescript                   2.6.2


ng update @angular/cli                   
404 Not Found: @angular/cli

ng update @angular/cli
404 Not Found: @types/jasmine

ng update @angular/cli --migrate-only --from=1.6.3
404 Not Found: @types/node

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants