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

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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 17
  • Comments: 30 (1 by maintainers)

Most upvoted comments

Added to the top of our backlog

@alexeagle, @hansl, could we also have the fix on 6.2.x please? Moving to 7.0.0-rc* creates other problems with dependencies that are not ready for 7.0

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

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/*"
      ]
    }

@johanchouquet sometimes typescript version errors can be hidden by vscode. VSCode, so long as it is kept updated, seems to always use the latest typescript version for intellisense. If your project has an older version of typescript installed, this means that vscode may not show you errors if you accidentally use a typescript feature that is newer than the typescript version your project is using (or if you depend on a library which, in turn, depends on a newer typescript version than you are using).

For example, a firebase functions project of mine was using typescript ~3.2. But I accidentally pulled in a library which made use of the new readonly Array<T> and as const syntax introduced in typescript 3.4. The error showed up as a strange syntax error at compile time. VSCode understood the syntax (because it was using typescript 3.5 to power intellisense), but the version of typescript using during compilation did not. The version of typescript used during compilation didn’t even know how to define the error really. It said something like “variable declaration expected” or “unexpected [”.

6.2.0, 7.0.0 😔

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

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.

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