LearnNewsExamplesServices
Frontmatter
id6619
titleEINVAL / EPERM error when running build script on Windows due to D:\System Volume Information
stateClosed
labels
bugstale
assignees[]
createdAtApr 5, 2025, 7:27 AM
updatedAtOct 23, 2025, 12:54 AM
githubUrlhttps://github.com/neomjs/neo/issues/6619
authorahmad-su
commentsCount5
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 19, 2025, 5:02 AM

EINVAL / EPERM error when running build script on Windows due to D:\System Volume Information

Closed v10.0.0 bugstale
ahmad-su
ahmad-su commented on Apr 5, 2025, 7:27 AM

Description

When trying to build the appworker thread using the build script (build-all or build-threads), I get either:

  • EINVAL: invalid argument, stat 'D:\System Volume Information', or
  • EPERM: operation not permitted, stat 'D:\System Volume Information' (when not running as administrator)

This occurs on Windows when building the Neo.mjs project.

Cause

The script (likely through ContextModule.resolveDependencies) tries to access restricted system folders like D:\System Volume Information, which is not permitted.


Environment

  • OS: Windows 11
  • Node.js: v23.10
  • Neo.mjs: latest
  • Terminal: PowerShell

Additional Info

It appears that Webpack is attempting to resolve .mjs files across the entire project directory, including protected system folders. This causes permission errors on Windows.


Log

neoapp buildThreads starting dist/production
assets by status 69.9 KiB [cached] 3 assets
orphan modules 202 KiB [orphan] 27 modules
runtime modules 3.37 KiB 8 modules
built modules 275 KiB [built]
  modules by path ./node_modules/neo.mjs/src/core/*.mjs 21.3 KiB
    ./node_modules/neo.mjs/src/core/Base.mjs 19.9 KiB [built] [code generated]
    ./node_modules/neo.mjs/src/core/IdGenerator.mjs 1.39 KiB [built] [code generated]
  modules by path ./node_modules/neo.mjs/src/util/*.mjs 10.1 KiB
    ./node_modules/neo.mjs/src/util/Function.mjs 5.31 KiB [built] [code generated]
    ./node_modules/neo.mjs/src/util/Array.mjs 4.76 KiB [built] [code generated]
  ./node_modules/neo.mjs/src/worker/App.mjs + 24 modules 212 KiB [built] [code generated]
  ../../../ lazy ^\.\/.*\.mjs$ include: (?:\/%7C\\)app.mjs$ exclude: (?:\/%7C\\)no...(truncated) 160 bytes [built] [code generated]
  ./node_modules/neo.mjs/src/remotes/Api.mjs 1.81 KiB [built] [code generated]
  ./node_modules/neo.mjs/src/vdom/Helper.mjs + 3 modules 30.1 KiB [built] [code generated]

ERROR in ../../../ lazy ^\.\/.*\.mjs$ include: (?:\/%7C\\)app.mjs$ exclude: (?:\/%7C\\)node_modules strict namespace object
EINVAL: invalid argument, stat 'D:\System Volume Information'
caused by plugins in ContextModule.resolveDependencies
Error: EINVAL: invalid argument, stat 'D:\System Volume Information'
 @ ./node_modules/neo.mjs/src/worker/App.mjs 301:19-306:13

What I’ve Tried

  • Reinstall dependencies & rebuild as administrator npm i && npm run build-threads : leads to EINVAL err
  • Filter out the system folder in neo.mjs/src/worker/App.mjs, but looks like it's not the case:
if (!path.includes('D:\\System')) {
    return import(
        /* webpackInclude: /(?:\/|\\)app.mjs$/ */
        /* webpackExclude: /(?:\/|\\)node_modules/ */
        /* webpackMode: "lazy" */
        `../../${path}.mjs`
    )
} 

Let me know if you need help reproducing it. Thanks

tobiu
tobiu Apr 5, 2025, 4:55 PM

@ahmad-su Without having Windows installed, I can sadly not help too much on this one (flying blind).

I am sure though, that the problem is the following regex comment: /* webpackInclude: /(?:\/|\\)app.mjs$/ */. For / based file systems it does work fine, for \ it looks like it does not.

Let me explain what it is supposed to do:

For a webpack based build, the app worker => worker/App.mjs file is supposed to find all app.mjs files.

Inside the framework repo, it needs to go 2 folder levels up (repo root), and it can then find the target files inside the apps, examples & docs folder.

Inside a workspace, it needs to go 4 folder levels up, since neo is inside node_modules/neo.mjs/.

If it would try to go further up, there might be security related restrictions (permission denied).

The main idea is, that by fetching all app.mjs files, we do get split chunks & tree-shaking across multiple apps out of the box. E.g. if you would lazy-load a 2nd neo app into your website, there should be little overhead.

@ahmad-su - 2025-04-05T16:11:36Z

Thanks for the insight @tobiu , the solution is just by nesting the project folder 1 level deeper. so ../.. will not accidentally go to D:
But I'm still curious to modify the App.mjs to make it work wherever I place the project.

@github-actions - 2025-07-05T02:53:16Z

This issue is stale because it has been open for 90 days with no activity.

  • 2025-07-05T02:53:17Z @github-actions added the stale label

@github-actions - 2025-07-19T03:02:59Z

This issue was closed because it has been inactive for 14 days since being marked as stale.

  • 2025-07-19T03:02:59Z @github-actions closed this issue