TypeError when building project, after upgrading to v2.0.0-beta.19
See original GitHub issueHave you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn 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
- 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 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)
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:
- Created a year ago
- Reactions:11
- Comments:56 (19 by maintainers)
Top GitHub Comments
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 astripBom
function, which does not sound familiar to me.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 entirebuild
directory andnode_modules
to aid in troubleshooting.