Skip to content

dev-scripts path issue on Windows #955

Closed
@zaaakher

Description

@zaaakher

Describe the bug
Running npm run gen throws the following error on Windows:

image

To Reproduce

  • Be on Windows 10
  • Run npm install
  • Run npm run gen from the root of the project or from examples dir
  • See the same error as the screenshot above

Misc

  • Node version: 18.20.3
  • Package manager: pnpm
  • Browser: Chrome
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

I was hitting my head for an hour trying to figure this one out. When I comment out fs.writeFileSync the error is gone, and this seems to be originating from the way we're getting the path/dir :

const dir = path.parse(import.meta.url.replace("file://", "")).dir;

This issue is in every instance of the above code, in gen.ts, genDocs.ts, and util.ts


I was only able to generate the example code in #954 using my MacOS. So this issue is exclusively on Windows.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions