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

Build errors when --out-dir includes dot in path segment #8135

Closed
2 of 7 tasks
mfaux opened this issue Sep 26, 2022 · 7 comments · Fixed by #8481
Closed
2 of 7 tasks

Build errors when --out-dir includes dot in path segment #8135

mfaux opened this issue Sep 26, 2022 · 7 comments · Fixed by #8481
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@mfaux
Copy link

mfaux commented Sep 26, 2022

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

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.

  1. Create a new docusaurus site:
    npx create-docusaurus@latest my-website classic
    
  2. 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:

image

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.
@mfaux mfaux 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 Sep 26, 2022
@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Sep 26, 2022
@Josh-Cena
Copy link
Collaborator

This is tricky... This error seems to be directly thrown from webpack.

@mfaux
Copy link
Author

mfaux commented Sep 27, 2022

Thanks for investigating!

@slorber
Copy link
Collaborator

slorber commented Sep 29, 2022

This is tricky... This error seems to be directly thrown from webpack.

curious to know what led you to this conclusion? any stacktrace to share?


Surprisingly the build/product/6.0 folder exists after the error, so why can't it be opened 😅 maybe it tries to open it as a file?

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Sep 29, 2022

Ah, the debugging trick is called "inserting console.log("HELLO") everywhere" 😄

The error is thrown from here:

if (err) {
logger.error(err.stack ?? err);
if (err.details) {
logger.error(err.details);
}
reject(err);
}

Note that server.bundle.js exists, so it must occur somewhere late in SSG phase.

@mfaux
Copy link
Author

mfaux commented Sep 29, 2022

Can't beat console.log!

@slorber
Copy link
Collaborator

slorber commented Sep 30, 2022

😅 can't figure where this come from.

Hopefully it shouldn't block you: the workaround is just to rename the folder after a build and it should work?

@mfaux
Copy link
Author

mfaux commented Sep 30, 2022

It's not a blocker (sorry, I should have mentioned that). I have a workaround to test the build.

@Josh-Cena Josh-Cena added the status: needs more information There is not enough information to take action on the issue. label Oct 13, 2022
@Josh-Cena Josh-Cena removed the status: needs more information There is not enough information to take action on the issue. label Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants