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.

ngcc error on package @sitecore-jss/sitecore-jss-angular

See original GitHub issue

🐞 bug report

Affected Package

@sitecore-jss/sitecore-jss-angular

Description

Trying to update an NX repo running the npm run update command. This results in trying to upgrade to angular 9, which was the ultimate goal.

Along the way I get this error:

Error: Error on worker #3: Error: Tried to overwrite <removed>/node_modules/@sitecore-jss/sitecore-jss-angular/dist/components/file.directive.d.ts.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.

I have already tried clearing npm node_modules, clean install etc. No effect.

🔬 Minimal Reproduction

This can be repro-ed by installing the @sitecore-jss/sitecore-jss-angular package and the running the following command:

ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points

🌍 Your Environment

Angular Version:

Updating package.json with dependency @nrwl/angular @ "9.1.2" (was "8.12.1")... The NX update process tries to update as follows:

Updating package.json with dependency @angular/cli @ "9.0.1" (was "8.3.3")...
    Updating package.json with dependency @angular/language-service @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.900.1" (was "0.803.3")...
    Updating package.json with dependency @angular/compiler-cli @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/animations @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/common @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/core @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/forms @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/platform-browser @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/compiler @ "9.0.7" (was "8.2.8")...
    Updating package.json with dependency @angular/router @ "9.0.7" (was "8.2.8")...

I’m not sure whether I should file the report here or on the sitecore-jss repo. If this is the wrong place, please let me know.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JoostKcommented, Mar 20, 2020

Hallo Erik! 🇳🇱

This package appears to incorrectly include two package.json files. These are processed by ngcc individually, but they target the same files. ngcc disallows this; files should only be processed once.

Can you try ignoring the package.json in the dist directory by creating a ngcc.config.js file next to your package.json:


module.exports = {
  packages: {
    '@sitecore-jss/sitecore-jss-angular': {
      entryPoints: {
        './dist': {
          ignore: true,
        },
      },
    },
  },
};

If I didn’t make a mistake in typing that, it should start to work. I do recommend to clear node_modules once more before trying again.

0reactions
angular-automatic-lock-bot[bot]commented, Jun 19, 2020

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

Angular ng serve produces Error: NGCC failed - Stack Overflow
I just updated angular cli, material and core, and other modules needed to my project, then updated npm and typescript package, and that's ......
Read more >
ngcc: packages that fail with errors causes a crash #34500
When ngcc processes a package that fails to compile, a fatal error that crashes the compiler occurs. Minimal Reproduction. For example ...
Read more >
error: failed to initialize angular compilation - ngcc failed.
I just updated angular cli, material and core, and other modules needed to my project, then updated npm and typescript package, and that's...
Read more >
The Angular linker (goodbye ngcc!) - Ninja Squad
This is ngcc compiling Angular packages and our library into an Ivy compatible format. If you open node_modules/tiny-lib , you'll spot a new ......
Read more >
help with webpack error : r/Angular2 - Reddit
ngcc ends up modifying the contents of already installed node_modules. Sometimes it helps to run rm -rf node_modules && npm i when ngcc...
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