question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

6.0.0-rc.7 Regression: Cannot find package.json when running ng update

See original GitHub issue

I’ve got a project I want to update to Angular v6. First step was to move update the CLI from 1.7.4 to 6.0.0-rc.7. Found that didn’t work.

Note that this error does not come up if you update to the previous 6.0.0-rc.6 version.

Versions

Started with this before changing my package.json to 6.0.0-rc.7

Angular CLI: 1.7.4
Node: 8.9.4
OS: darwin x64
Angular: 5.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

@angular/cdk: 5.2.4
@angular/cli: 1.7.4
@angular/material: 5.2.4
@angular/tsc-wrapped: 4.4.6
@ngtools/webpack: error
@schematics/package-update: 0.3.2
typescript: 2.4.2
webpack: error

Repro steps

Observed behavior

An error message is printed telling me that it cannot find a package.json.

Could not find a package.json. Are you in a Node project?

Desired behavior

CLI successfully updates itself.

Mention any other details that might be useful (optional)

Do you intend to show a message when users update @angular/cli to v6 using yarn? I noticed that with npm i I see the following message:

====================================================================
The Angular CLI configuration format has been changed, and your existing configuration can
be updated automatically by running the following command:

  ng update @angular/cli
====================================================================

But if I do the update using yarn, no message is provided that lets me know to do anything.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

2reactions
gerhardboercommented, Apr 29, 2018

I’m having the same problem, and i’ve traced it down to a line in @angular/cli/models/schematic-command.js:73, where this.project.root is set to my User folder, instead of the project folder. If I set the property to an absolute URL of the location of the project, the command goes through as expected. I’m not sure (yet) how the project.root is set, but maybe this information helps

EDIT After some more research, i’ve found that a reference to .angular-cli.json is missing from line https://github.com/angular/angular-cli/blob/c7088901b70d850cc818d002daa30dd100d57c22/packages/%40angular/cli/lib/cli/index.ts#L52 .

0reactions
angular-automatic-lock-bot[bot]commented, Sep 20, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module '@angular/compiler' - Stack Overflow
Problem was that I installed ng-mocks into the root-package.json which was of course wrong. I removed it there and installed it to the...
Read more >
How To Update Angular CLI To Latest Version
First Update your Angular app to Angular 9. Then use ng update command. Angular CLI version check. Before updating check the Angular version ......
Read more >
the installed angular cli version is older than the latest stable ...
When I run the command ng update @angular/material@8 , I get the following: ... An unhandled exception occurred: Could not find package.json See ......
Read more >
Upgrading an Application to Angular 6: Step By Step - Blog
ng update. This command updates your package.json file to the latest Angular-related package versions. I was happy to see that it left all ......
Read more >
Package List — Spack 0.20.0.dev0 documentation
Versions: 2.7.7; Build Dependencies: gnuconfig, python, java; Run ... A package universe and a request to install, remove, or upgrade packages have to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found