Skip to content

Error when starting dev server from yarn PnP environments #36

@acusti

Description

@acusti

first of all, this is a really cool project! i’m very excited to migrate my existing RR7 Cloudflare Workers app to it.

i use yarn PnP (v4.9.1 currently), and running the dev run script (in the repo that is created after doing yarn create orange) results in the following error:

error when starting dev server:
Error: ENOTDIR: not a directory, open '/node_modules/@cloudflare/vite-plugin/dist/index.js/package.json'
    at makeError$1 (/Users/me/orange/.pnp.cjs:4831:24)
    at ENOTDIR (/Users/me/orange/.pnp.cjs:4849:10)
    at ZipFS.resolveFilename (/Users/me/orange/.pnp.cjs:9536:15)
    at ZipFS.readFileBuffer (/Users/me/orange/.pnp.cjs:9971:28)
    at ZipFS.readFileSync (/Users/me/orange/.pnp.cjs:9965:23)
    at /Users/me/orange/.pnp.cjs:7243:22
    at /Users/me/orange/.pnp.cjs:7366:66
    at ZipOpenFS.getMountSync (/Users/me/orange/.pnp.cjs:7474:14)
    at ZipOpenFS.makeCallSync (/Users/me/orange/.pnp.cjs:7366:17)
    at ZipOpenFS.readFileSync (/Users/me/orange/.pnp.cjs:7240:17)

i’m guessing that this is triggered by installedNodeModules: https://github.com/orange-framework/orange-js/blob/main/packages/cli/src/commands/provision/index.ts#L93

and that somehow that utility is being called when executed from the context of the @cloudflare/vite-plugin/dist/index.js entry file. or maybe i’m making inaccurate assumptions.

in my experience with yarn PnP, process.cwd() returns the path to the directory from which the node process began in the same way that it works when using npm, but maybe this is an edgecase where that isn’t the case, because switching yarn’s nodeLinker from pnp to node-modules resolves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions