Skip to content

EPERM: operation not permitted on npm run dev on Windows due to incorrect path generation #3194

@andresnb

Description

@andresnb

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

@shopify/hydrogen

What version of Remix are you using?

2025.5.0

Steps to Reproduce

On a Windows machine, use npm create @shopify/hydrogen@latest to create a new project in a user-level directory (e.g., C:\Users\YourUser\dev).
Navigate into the newly created project directory.
Run npm run dev from a terminal that is not running with administrator privileges.

Expected Behavior

The development server should start successfully without requiring administrator privileges.

Actual Behavior

The command fails with an EPERM: operation not permitted error. The build process attempts to write to an incorrectly constructed path that duplicates the Users directory (e.g., C:\Users\Users\<username>\... instead of C:\Users\<username>\...).

The full error is:

Error: EPERM: operation not permitted, open 'C:\Users\Users\andre\PandaIT\dev\pau-henriques\node_modules\@shopify\hydrogen\dist\vite\virtual-routes\+types\layout.ts'
    at Object.writeFileSync (node:fs:2425:20)
    at C:\Users\andre\PandaIT\dev\pau-henriques\node_modules\@react-router\dev\dist\vite.js:974:29
    at Array.forEach (<anonymous>)
    at writeAll (C:\Users\andre\PandaIT\dev\pau-henriques\node_modules\@react-router\dev\dist\vite.js:970:36)
    at watch (C:\Users\andre\PandaIT\dev\pau-henriques\node_modules\@react-router\dev\dist\vite.js:928:9)

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