Build errors when `--out-dir` includes dot in path segment
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
When calling npm run build -- --out-dir
, if the directory contains a path segment with a dot .
, the build fails with errors.
For example, the directory build/product/6.0/
causes errors.
Reproducible demo
No response
Steps to reproduce
Tested using git bash on Windows 10.
- Create a new docusaurus site:
npx create-docusaurus@latest my-website classic
- Go to
my-website
and run:npm run build -- --out-dir "build/product/6.0/"
Expected behavior
The site builds correctly at the directory build/product/6.0/
, relative to the docusaurus project.
Actual behavior
The results:
$ npm run build -- --out-dir "build/product/6.0/"
> my-website@0.0.0 build
> docusaurus build --out-dir build/product/6.0/
[INFO] [en] Creating an optimized production build...
✔ Client
● Server █████████████████████████ sealing (92%) asset processing
RealContentHashPlugin
[ERROR] Error: EISDIR: illegal operation on a directory, open 'C:\temp\my-website\build\product\6.0'
[ERROR] Unable to build website for locale en.
[ERROR] Error: EISDIR: illegal operation on a directory, open 'C:\temp\my-website\build\product\6.0'
[INFO] Docusaurus version: 2.1.0
Node version: v18.9.0
The build output is partially successful, but is missing the docs
and img
directories:
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used: 2.1.0
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Node .js 18.9.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 10
Self-service
- I’d be willing to fix this bug myself.
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Module path maps are not resolved in emitted code #10866
Obviously node has no idea where to find the module. I would have expected typescript to resolve the module path and replace it...
Read more >The OutputPath property is not set for project
Open the Project Properties. Select the Build Tab. Under the Output section, Check that an output path is set. (if not set one,...
Read more >TSConfig Reference - Docs on every TSConfig option
It would be an error to specify rootDir as core and include as * because it creates a file ( helpers.ts ) that...
Read more >MSBuild reference for .NET SDK projects
Reference for the MSBuild properties and items that are understood by the .NET SDK.
Read more >file.path: Construct Path to File
Trailing path separators are invalid for Windows file paths apart from '/' and 'd:/' (although some functions/utilities do accept them), so a trailing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, the debugging trick is called “inserting
console.log("HELLO")
everywhere” 😄The error is thrown from here:
https://github.com/facebook/docusaurus/blob/c6f5cf9ac75f9942203d1570697d928098abcaeb/packages/docusaurus/src/webpack/utils.ts#L243-L249
Note that server.bundle.js exists, so it must occur somewhere late in SSG phase.
This is tricky… This error seems to be directly thrown from
webpack
.