neo icon indicating copy to clipboard operation
neo copied to clipboard

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

Open ahmad-su opened this issue 7 months ago • 3 comments
trafficstars

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.


Steps to Reproduce

  1. Run npx neo-app@latest or initiate a build using the generated script (npm run build-all or npm run build-threads).

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

ahmad-su avatar Apr 05 '25 05:04 ahmad-su