hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

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

Open andresnb opened this issue 3 months ago • 1 comments

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)

andresnb avatar Sep 25 '25 15:09 andresnb