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

Regression: project is not working anymore from 6.0.8 -> 6.1.0 (in lerna monorepos)

Open ctaepper opened this issue 8 years ago • 30 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [x] all

Repro steps

Our angular/cli project ist located as one package of a larger lerna monorepo. We also make use of yarn workspaces, so all (or most) dependencies are hoisted within one single root node_modules folder. The resulting structure is something like

- node_modules <-- angular dependencies installed here
  - @angular
    - cli
    - core
    - ...
- packages
  - angular-app
    - package.json <-- angular dependencies defined here
    - src
    - ....
- package.json <-- no angular dependencies defined here

this line now (as of 6.1.0) prevents the project from working (at all) because relativePotential.startsWith('..') === true because in our structure relativePotential = ../../node_modules/@angular/core/package.json

everything was working fine with 6.0.8

The log given by the failure

You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.

Desired functionality

I can work on my angular project with latest versions of everything

ctaepper avatar Jul 27 '18 08:07 ctaepper

Same setup - same issue here. Working on a workaround, I'll let you know if it works.

hunhavoc avatar Jul 27 '18 08:07 hunhavoc

I have been playing around with combining lerna packages with angular worspace, so I would pull the angular.json and all related dependencies into the root package. Then the lerna packages would be semantically the same as the angular workspace libraries/applications. This would also "fix" this bug, as the angular project root would be equal to the lerna root. I am confident this will work (and will be cool)

However this is not something we can easily achieve in existing projects and I still see this as regression bug.

ctaepper avatar Jul 27 '18 09:07 ctaepper

Same here. We have tried both Lerna and Rush.js, same result.

jSchez avatar Jul 27 '18 11:07 jSchez

@hansl I am happy to create a PR for this issue. However, this is not really a bug in the code, more like a decision on how you check for dependencies. Is there anything I can do to speed this up?

ctaepper avatar Jul 30 '18 13:07 ctaepper

maybe there is the need for a setting in angular.json to make clear what is considered to "be within the project"

ctaepper avatar Jul 30 '18 13:07 ctaepper

See this issue with linked PRs https://github.com/angular/angular-cli/issues/3864

cormacrelf avatar Aug 01 '18 10:08 cormacrelf

still broken in 6.1.2

ctaepper avatar Aug 02 '18 08:08 ctaepper

6.1.3 🤷‍♂️

ctaepper avatar Aug 10 '18 07:08 ctaepper

Added to the top of our backlog

alexeagle avatar Aug 10 '18 16:08 alexeagle

In the meantime, not ideal, but a quick fix on the lerna.json file to NOT hoist certain dependencies..

    "bootstrap": {
      "nohoist": [
        "@angular/*",
        "@angular-devkit/build-angular",
        "rxjs",
        "@ngtools/*"
      ]
    }

iangregsondev avatar Aug 27 '18 11:08 iangregsondev

Actually, even this fix above is a nightmare as anything that is used by the UI needs to be set as a NOHOIST ...... So its a lot of packages. Anybody find an alternative fix ?

iangregsondev avatar Aug 27 '18 13:08 iangregsondev

I am using 6.1.5 (installed today).

iangregsondev avatar Aug 27 '18 13:08 iangregsondev

@appsolutegeek try to add your dependencies in the root package.json. Then you will be able to hoist the dependencies within your packages.

jSchez avatar Aug 27 '18 13:08 jSchez

I'm having the same issue, with only using Yarn workspaces. The nohoist option in package.json is indeed a fair temporary fix (thanks @appsolutegeek!) - hopefully this' will be fixed in the future.

gombosg avatar Aug 29 '18 11:08 gombosg

@gombosg no problem, hopefully, we can update the cli soon, so I can remove the NO HOIST packages.

iangregsondev avatar Aug 29 '18 13:08 iangregsondev

sadly, the nohoist option is only available for private packages

also sadly

Added to the top of our backlog

does not seem to mean "this is the very next issue that gets fixed"

ctaepper avatar Sep 03 '18 11:09 ctaepper

6.2.0, 7.0.0 😔

ctaepper avatar Sep 07 '18 05:09 ctaepper

Is there any update when the issue will be fixed?

fabianbru avatar Sep 11 '18 07:09 fabianbru

@hansl 👍

ctaepper avatar Sep 26 '18 13:09 ctaepper

wait a minute, why did this not land in 6.2.4 ???

ctaepper avatar Oct 02 '18 11:10 ctaepper