Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NX MF build failing with ENOENT: no such file or directory, scandir '' #27989

Closed
1 of 4 tasks
vaclav-antosik opened this issue Sep 19, 2024 · 6 comments · Fixed by #27994
Closed
1 of 4 tasks

NX MF build failing with ENOENT: no such file or directory, scandir '' #27989

vaclav-antosik opened this issue Sep 19, 2024 · 6 comments · Fixed by #27994
Assignees
Labels
os: windows Issues that can only be replicated on Windows outdated scope: module federation Issues related to module federation support type: bug

Comments

@vaclav-antosik
Copy link

Current Behavior

Creating vanilla workspace in version 19.7.4 adding MF Angular host application and doing production build leads into error -> ENOENT: no such file or directory, scandir '' and there is no "dist" directory created.

Commands I'm running:
npx create-nx-workspace@latest my-workspace10
npm install --save-dev @nx/angular
npx nx g @nx/angular:host host
npx nx build host

It was working before. I reproduced those commands using version 18.3.1 and it works.
Same behavior was observed on another 2 windows machines (I asked colleagues to try).

Expected Behavior

Build should be successful and "dist" folder should be created with bundles.

GitHub Repo

No response

Steps to Reproduce

1, npx create-nx-workspace@latest my-workspace10
image

2, npm install --save-dev @nx/angular

3, npx nx g @nx/angular:host host
image

4, npx nx build host

Nx Report

Node           : 22.8.0
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.8.3

nx                 : 19.7.4
@nx/js             : 19.7.4
@nx/jest           : 19.7.4
@nx/linter         : 19.7.4
@nx/eslint         : 19.7.4
@nx/workspace      : 19.7.4
@nx/angular        : 19.7.4
@nx/devkit         : 19.7.4
@nx/eslint-plugin  : 19.7.4
@nrwl/tao          : 19.7.4
@nx/web            : 19.7.4
@nx/webpack        : 19.7.4
typescript         : 5.5.4

Failure Logs

(node:16064) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
- Generating browser application bundles (phase: setup)...
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
(node:12672) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
[ Module Federation Manifest Plugin ]: Manifest will use absolute path resolution via its host at runtime, reason: publicPath='auto'
    [webpack.cache.PackFileCacheStrategy] No pack exists at C:\Projects\nx\my-workspace10\.angular\cache\18.2.5\angular-webpack\17fb4e93c23199c6209d45f0039415bbd2a3f2a0.pack: Error: ENOENT: no such file or directory, stat 'C:\Projects\nx\my-workspace10\.angular\cache\18.2.5\angular-webpack\17fb4e93c23199c6209d45f0039415bbd2a3f2a0\index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 8.0331 ms
    [IdleFileCachePlugin] Initial cache was generated and cache will be persisted in 5s.
✔ Browser application bundle generation complete.
 NX   ENOENT: no such file or directory, scandir ''
HookWebpackError: ENOENT: no such file or directory, scandir ''
    at makeWebpackError (C:\Projects\nx\my-workspace10\node_modules\webpack\lib\HookWebpackError.js:48:9)
    at C:\Projects\nx\my-workspace10\node_modules\webpack\lib\Compilation.js:3204:12
    at eval (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)
    at fn (C:\Projects\nx\my-workspace10\node_modules\webpack\lib\Compilation.js:493:17)
    at _next6 (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:28:1)
    at eval (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:46:1)
    at fn (C:\Projects\nx\my-workspace10\node_modules\webpack\lib\Compilation.js:505:9)
    at _next5 (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at eval (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:60:1)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
-- inner error --
Error: ENOENT: no such file or directory, scandir ''
    at Object.readdirSync (node:fs:1502:26)
    at CacheBackend.provideSync (C:\Projects\nx\my-workspace10\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:332:58)
    at WebpackFileSystem.listPaths (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackFileSystem.js:78:24)
    at LicenseTextReader.readLicense (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\LicenseTextReader.js:37:54)
    at PluginChunkReadHandler.processModule (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:71:62)
    at C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:24:27
    at WebpackInnerModuleIterator.internalCallback (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:39:13)
    at WebpackInnerModuleIterator.iterateModules (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:21:9)
    at C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:20:39
    at WebpackChunkModuleIterator.iterateModules (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackChunkModuleIterator.js:42:21)
    at PluginChunkReadHandler.processChunk (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:19:29)
    at _loop_1 (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackCompilerHandler.js:135:37)
    at WebpackCompilerHandler.iterateChunks (C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackCompilerHandler.js:160:17)
    at C:\Projects\nx\my-workspace10\node_modules\license-webpack-plugin\dist\WebpackCompilerHandler.js:50:31
    at fn (C:\Projects\nx\my-workspace10\node_modules\webpack\lib\Compilation.js:491:10)
    at _next6 (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:28:1)
    at eval (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:46:1)
    at fn (C:\Projects\nx\my-workspace10\node_modules\webpack\lib\Compilation.js:505:9)
    at _next5 (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:41:1)
    at eval (eval at create (C:\Projects\nx\my-workspace10\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:60:1)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

Package Manager Version

npm version 10.8.3

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Exactly same steps repeated for nx version 18.3.1 works.

@vaclav-antosik
Copy link
Author

Additional information:
It builds correctly on ubuntu wsl
image

@Coly010
Copy link
Contributor

Coly010 commented Sep 19, 2024

@vaclav-antosik Can you run npm ls @module-federation/enhanced?

This seems to be an external issue from Nx, but I'll see what I can do about it

@vaclav-antosik
Copy link
Author

@Coly010
image

@isunilmekala
Copy link

isunilmekala commented Sep 19, 2024

FYI , I have tried the same build using Nx 19.6.5 and it worked.

Build at: 2024-09-19T12:02:38.786Z - Hash: 6ffc595629eebbe8 - Time: 9211ms

NX Successfully ran target build for project login

PS C:\Workspaces\temp\nx-ng-dyn-fed> nx report

NX Report complete - copy this into the issue template

Node : 22.3.0
OS : win32-x64
Native Target : x86_64-windows
npm : 10.8.3

nx (global) : 19.7.4
nx : 19.6.5
@nx/js : 19.6.5
@nx/jest : 19.6.5
@nx/linter : 19.6.5
@nx/eslint : 19.6.5
@nx/workspace : 19.6.5
@nx/angular : 19.6.5
@nx/cypress : 19.6.5
@nx/devkit : 19.6.5
@nx/eslint-plugin : 19.6.5
@nrwl/tao : 19.6.5
@nx/web : 19.6.5
@nx/webpack : 19.6.5
typescript : 5.5.4

Registered Plugins:
@nx/cypress/plugin
@nx/eslint/plugin

PS C:\Workspaces\temp\nx-ng-dyn-fed> npm ls @module-federation/enhanced
@ng-mf/source@0.0.0 C:\Workspaces\temp\nx-ng-dyn-fed
+-- @nx/angular@19.6.5
| -- @module-federation/enhanced@0.2.8 -- @nx/webpack@19.6.5
`-- @module-federation/enhanced@0.2.8 deduped

@Coly010
Copy link
Contributor

Coly010 commented Sep 19, 2024

Yeah there's a correlation between the issue and the @module-federation/enhanced package + license-webpack-plugin.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
os: windows Issues that can only be replicated on Windows outdated scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants