Skip to content

EISDIR error when cert path is a directory instead of a file #486

Description

@kathryn-moon-xylophone

lando rebuild fails with:
ERROR ==> EISDIR: illegal operation on a directory, open '/Users/***/.lando/certs/appserver.***.crt'

write-file.js's default case only checked !fs.existsSync(file) before creating parent directories. If a directory existed at the target file path (e.g., from a previous malformed cert generation), existsSync returned true, skipping mkdir, and fs.writeFileSync crashed with EISDIR.

Fix

utils/write-file.js — In the default case, check if the target path exists and is a directory. If so, remove it before writing the file. Also replaced deprecated fs.rmdirSync({recursive: true}) with fs.rmSync({recursive: true}).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions