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.

Build errors when `--out-dir` includes dot in path segment

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

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
Josh-Cenacommented, Sep 29, 2022

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.

1reaction
Josh-Cenacommented, Sep 27, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

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