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.

TypeError when building project, after upgrading to v2.0.0-beta.19

See original GitHub issue

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I’m using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

While upgrading our project to from Docusaurus v2.0.0-beta.18 to v2.0.0-beta.19 we are now encountering an issue during the build.

Reproducible demo

No response

Steps to reproduce

  1. Upgrade docusaurus using the command npm i @docusaurus/core@2.0.0-beta.19 @docusaurus/preset-classic@2.0.0-beta.19 @docusaurus/module-type-aliases@2.0.0-beta.19 from v2.0.0-beta-18
  2. npm run build

Expected behavior

To have no problems building. The chalk_1.default.bold TypeError doesn’t seem related to any breaking changes introduced in the beta-19 version and there are no existing related issues either.

Actual behavior

To upgrade, we ran npm i @docusaurus/core@2.0.0-beta.19 @docusaurus/preset-classic@2.0.0-beta.19 @docusaurus/module-type-aliases@2.0.0-beta.19.

Then when running npm run build we run into the below output:

TypeError: chalk_1.default.bold is not a function
TypeError: chalk_1.default.bold is not a function
TypeError: chalk_1.default.bold is not a function
TypeError: chalk_1.default.bold is not a function
TypeError: chalk_1.default.bold is not a function
TypeError: chalk_1.default.bold is not a function
TypeError: chalk_1.default.bold is not a function
... (many more times)
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@babel/core/lib/config/files/configuration.js","moduleName":"./node_modules/@babel/core/lib/config/files/configuration.js","loc":"163:150-157","message":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@babel/core/lib/config/files/import.js","moduleName":"./node_modules/@babel/core/lib/config/files/import.js","loc":"9:9-25","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@babel/core/lib/config/files/module-types.js","moduleName":"./node_modules/@babel/core/lib/config/files/module-types.js","loc":"89:17-34","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@babel/core/lib/config/files/plugins.js","moduleName":"./node_modules/@babel/core/lib/config/files/plugins.js","loc":"148:144-151","message":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@babel/helper-define-polyfill-provider/lib/node/dependencies.js","moduleName":"./node_modules/@babel/helper-define-polyfill-provider/lib/node/dependencies.js","loc":"32:13-20","message":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@babel/helper-define-polyfill-provider/lib/node/dependencies.js","moduleName":"./node_modules/@babel/helper-define-polyfill-provider/lib/node/dependencies.js","loc":"54:6-13","message":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/@svgr/core/dist/index.js","moduleName":"./node_modules/@svgr/core/dist/index.js","loc":"159:33-52","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/browserslist/node.js","moduleName":"./node_modules/browserslist/node.js","loc":"171:18-76","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/browserslist/node.js","moduleName":"./node_modules/browserslist/node.js","loc":"171:26-33","message":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/browserslist/node.js","moduleName":"./node_modules/browserslist/node.js","loc":"192:16-195:6","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/browserslist/node.js","moduleName":"./node_modules/browserslist/node.js","loc":"192:24-31","message":"Critical dependency: require function is used in a way in which dependencies cannot be statically extracted","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/import-fresh/index.js","moduleName":"./node_modules/import-fresh/index.js","loc":"32:31-48","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/svgo/lib/svgo-node.js","moduleName":"./node_modules/svgo/lib/svgo-node.js","loc":"22:13-32","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/svgo/lib/svgo-node.js","moduleName":"./node_modules/svgo/lib/svgo-node.js","loc":"27:42-75","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/svgo/lib/svgo-node.js","moduleName":"./node_modules/svgo/lib/svgo-node.js","loc":"32:17-36","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[WARNING] {"moduleIdentifier":"/Users/rebecca.tiessen/workspace/developer-docs/node_modules/url-loader/dist/index.js","moduleName":"./node_modules/url-loader/dist/index.js","loc":"120:19-42","message":"Critical dependency: the request of a dependency is an expression","compilerPath":"server"}
[ERROR] Unable to build website for locale en.
[ERROR] Error: Failed to compile with errors.
    at /Users/rebecca.tiessen/workspace/developer-docs/node_modules/@docusaurus/core/lib/webpack/utils.js:182:24
    at /Users/rebecca.tiessen/workspace/developer-docs/node_modules/webpack/lib/MultiCompiler.js:554:14
    at processQueueWorker (/Users/rebecca.tiessen/workspace/developer-docs/node_modules/webpack/lib/MultiCompiler.js:491:6)
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Screen Shot 2022-05-10 at 4 21 06 PM

Apologies for not creating a reproducible demo, if that’s necessary to get this looked at then we can potentially schedule it into our work flow but we’ve spent a good amount of work time trying to debug this already. Thanks in advance if you’re able to provide any insights!

Your environment

  • Public source code: n/a (not public)
  • Public site URL: https://developer.boldcommerce.com/default/
  • Docusaurus version used: 2.0.0-beta-18
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node 16.3
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Monterey 12.3.1

Self-service

  • I’d be willing to fix this bug myself.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:11
  • Comments:56 (19 by maintainers)

github_iconTop GitHub Comments

8reactions
Josh-Cenacommented, May 13, 2022

Can I get a confirmation that everyone running into this issue is using some kind of redoc/open API plugin? I did some preliminary hacks and found that the content.replace problem is coming from a stripBom function, which does not sound familiar to me.

6reactions
sserratacommented, May 12, 2022

Reproduces Type Errors Observed in 2.0.0-beta.20

Variant 1

PR: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/81 Build output: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/runs/6396242136?check_suite_focus=true Description: Reproduces the TypeError: chalk_1.default.bold is not a function error.

Variant 2

PR: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/82 Build output: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/runs/6396568165?check_suite_focus=true Description: Reproduces the TypeError: content.replace is not a function error.

Variant 3

Description: Reproduces the TypeError: content.replace is not a function error on a standalone site. Repo: https://github.com/sserrata/docusaurus-type-error Note: Repo intentionally contains entire build directory and node_modules to aid in troubleshooting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

the request of a dependency is an expression - You.com
While upgrading our project to from Docusaurus v2.0.0-beta.18 to v2.0.0-beta.19 we are now encountering an issue during the build.
Read more >
webpack.validateSchema is not a function - Stack Overflow
After this I got another error when I tried running npm start which stated that there was a problem with my webpack config...
Read more >
Framework7 Release Notes
Dom7 update to latest 2.1.3: Fixed issue when event handlers attached with .once may not be detached correctly later. Phenome. Card. New ...
Read more >
构建项目时TypeError升级为v2.0.0-Beta.19 - 编程技术网
TypeError when building project, after upgrading to v2.0.0-beta.19. Have you read the Contributing Guidelines on issues?
Read more >
Angular-cli: TypeError: core.resolve is not a function - AngularFix
Issue. I have a pre-developed angular project, i just ran npm i to install its packages locally, then ng serve to run the...
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