Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
satanTime opened this issue Apr 30, 2021 · 13 comments
Labels
closed: question This issue is a user error/misunderstanding.

Comments

@satanTime
Copy link

🐛 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

@satanTime satanTime added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Apr 30, 2021
@slorber
Copy link
Collaborator

slorber commented May 1, 2021 via email

@satanTime
Copy link
Author

satanTime commented May 1, 2021

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

@slorber
Copy link
Collaborator

slorber commented May 1, 2021 via email

@satanTime
Copy link
Author

satanTime commented May 1, 2021

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.

@wibed
Copy link

wibed commented May 1, 2021

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

@slorber
Copy link
Collaborator

slorber commented May 1, 2021

@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

@wibed
Copy link

wibed commented May 2, 2021

@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.

@slorber
Copy link
Collaborator

slorber commented May 3, 2021

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

@slorber slorber closed this as completed May 3, 2021
@satanTime
Copy link
Author

satanTime commented May 3, 2021

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.

@slorber
Copy link
Collaborator

slorber commented May 3, 2021

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

@satanTime
Copy link
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.

@Caperious
Copy link

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

@satanTime
Copy link
Author

satanTime commented May 12, 2021

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

@Josh-Cena Josh-Cena added closed: question This issue is a user error/misunderstanding. and removed bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question This issue is a user error/misunderstanding.
Projects
None yet
Development

No branches or pull requests

5 participants