Skip to content

error building locale=en TypeError: Cannot read property 'intercept' of undefined #4709

Closed

Description

@satanTime

🐛 Bug Report

Cannot build docs on 2.0.0-alpha.75, 2.0.0-alpha.74 works well.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. The issue is here chore(deps): update docusaurus monorepo to v2.0.0-alpha.75 (patch) help-me-mom/ng-mocks#466
  2. Clone the repo
  3. Switch to branch renovate/root/patch-docusaurus-monorepo
  4. execute npm install
  5. execute npm run build:docs

Expected behavior

The build should succeed.

Actual Behavior

Fails with the next error

[en] Creating an optimized production build...
[info] [webpackbar] Compiling Client
error building locale=en
TypeError: Cannot read property 'intercept' of undefined
    at /Users/michael/projects/ng-mocks/node_modules/webpack/lib/ProgressPlugin.js:242:30
    at Array.forEach (<anonymous>)
    at /Users/michael/projects/ng-mocks/node_modules/webpack/lib/ProgressPlugin.js:239:24
    at Hook.eval [as call] (eval at create (/Users/michael/projects/ng-mocks/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
    at Hook.CALL_DELEGATE [as _call] (/Users/michael/projects/ng-mocks/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:1031:26)
    at /Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:1073:29
    at Hook.eval [as callAsync] (eval at create (/Users/michael/projects/ng-mocks/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/michael/projects/ng-mocks/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.compile (/Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:1068:28)
    at /Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:496:12
    at Compiler.readRecords (/Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:908:11)
    at /Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:493:11
    at Hook.eval [as callAsync] (eval at create (/Users/michael/projects/ng-mocks/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/michael/projects/ng-mocks/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/michael/projects/ng-mocks/node_modules/@docusaurus/core/node_modules/webpack/lib/Compiler.js:490:20

Your Environment

Reproducible Demo

https://app.circleci.com/pipelines/github/ike18t/ng-mocks/269/workflows/e0a901b4-03ab-4288-a0b1-34398ecd8204/jobs/7723/parallel-runs/0/steps/0-110

Activity

  1. added
    bug
    status: needs triage
    on Apr 30, 2021
  2. slorber commented on May 1, 2021

    @slorber
    Collaborator
  3. satanTime commented on May 1, 2021

    @satanTime
    Author

    There is no cache on my CI and docs are built from scratch on every commit, but I'll try it in some hours.

  4. slorber commented on May 1, 2021

    @slorber
    Collaborator
  5. satanTime commented on May 1, 2021

    @satanTime
    Author

    The idea is to follow monorepo approach. There is one global package.json which has all the dependencies for all projects in the repo and they are installed on the root level.
    docs are a project in the repo and the idea is that its package.json only describes desired dependencies and their versions (the same as in the global package.json), but all scripts use parent node_modules.

    I'll try to play with scripts, maybe ../node_modules/.bin is the issue.

  6. wibed commented on May 1, 2021

    @wibed

    I am experiencing the same issue with

    2.0.0-alpha.75 with i18n - https://pastebin.com/inhL60ap
    2.0.0-alpha.74 with i18n - https://pastebin.com/GqYi0M8t

    2.0.0-alpha.72 works but the i18n url breaks if there is a baseURL configured
    as pointed out here: #3309

  7. slorber commented on May 1, 2021

    @slorber
    Collaborator

    @wibed I don't understand how your problem is related to the current issue. This issue is a alpha 74 -> 75 upgrade problem.

    Please open another issue with a repro repository that I can inspect. error building locale=en is a very generic message that will be printed whenever a site does not build. Will try to improve it to make this clearer

  8. wibed commented on May 2, 2021

    @wibed

    @slorber indeed it does not.

    Ive mistakenly took the error, based on the message, for a similar problem.

    Ive been able to fix my issue, by rebuilding on the new .75 version bit by bit.

  9. slorber commented on May 3, 2021

    @slorber
    Collaborator

    This is not a problem in Docusaurus, but it is a problem in your repo @satanTime

    After upgrading to alpha.75 (now on Webpack 5), you still end up with node_modules/webpack being Webpack 4, while Docusaurus needs Webpack 5.

    It is your responsibility to not mess-up with the dependencies and ensure that Docusarus is able to use the Webpack version it needs, and I think your setup mess-up with the dependencies.

    If you are not using npm/yarn workspaces and the hoisting features permitting multiple webpack versions to cohabit, you should then rather install docusaurus deps independently in the docs subfolder.

    Eventually, you could try to add "webpack@5" at the root of your monorepo, it might permit Docusaurus to build, but it might break other things of your repo... this is not a solution I'd recommend.

    This PR shows that your site can definitively build using latest Docusaurus: help-me-mom/ng-mocks#475

  10. satanTime commented on May 3, 2021

    @satanTime
    Author

    Hi @slorber, thanks for the info... that is the thing I was afraid of. I tried webpack@5 in the global package.json but it didn't work out unfortunately.
    I'll try to play with it more. Thanks for your help.

    PS. Frankly speaking, I don't understand benefit of having a single package.json with all the deps... maybe one day... thanks again.

  11. slorber commented on May 3, 2021

    @slorber
    Collaborator

    PS. Frankly speaking, I don't understand benefit of having a single package.json with all the deps... maybe one day... thanks again.

    I don't know either 😅 you can't expect this strategy to remain sustainable over time particularly when your monorepo packages have different lifecycles and dependencies

  12. satanTime commented on May 3, 2021

    @satanTime
    Author

    yes, exactly :) I remember reading nxcreator's answer "You need time to understand why the global package.json works better", so I don't give up :) Although there were several bell rings and one more is here again.

  13. Caperious commented on May 12, 2021

    @Caperious

    @satanTime How did u resolve the issue? Moved the docusaurus to its own repo?

  14. satanTime commented on May 12, 2021

    @satanTime
    Author

    Hi @satanTime, not moving, but allowing it having own node_modules, before it had to be peerDependencies, now it is dependencies: help-me-mom/ng-mocks@91f4ee7

    Unfortunately, I wasn't able to make friends angular with webpack4 and docusaurus with webpack5 with a single package.json

  15. added
    closed: question
    and removed
    bug
    status: needs triage
    on Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed: question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions