question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HookWebpackError: ENOENT: no such file or directory, scandir

See original GitHub issue

Description After update to angular v12, get the error HookWebpackError: ENOENT: no such file or directory, scandir

Expected behavior The plugin should be generating an output file in the build dist directory as it did with the previous version of angular v11.

Actual behavior

[error] HookWebpackError: ENOENT: no such file or directory, scandir
    at makeWebpackError (~/scheduler/node_modules/webpack/lib/HookWebpackError.js:49:9)
    at ~/scheduler/node_modules/webpack/lib/Compilation.js:2496:12
    at eval (eval at create (~/scheduler/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:29:1)
    at fn (~/scheduler/node_modules/webpack/lib/Compilation.js:427:17)
    at _next6 (eval at create (~/scheduler/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:26:1)
    at eval (eval at create (~/scheduler/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:44:1)
    at fn (~/scheduler/node_modules/webpack/lib/Compilation.js:439:9)
    at _next5 (eval at create (~/scheduler/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:39:1)
    at eval (eval at create (~/scheduler/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:58:1)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
-- inner error --
Error: ENOENT: no such file or directory, scandir
    at Object.readdirSync (fs.js:955:3)
    at CacheBackend.provideSync (~/scheduler/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:233:32)
    at WebpackFileSystem.listPaths (~/scheduler/node_modules/license-webpack-plugin/dist/WebpackFileSystem.js:78:24)
    at LicenseTextReader.readLicense (~/scheduler/node_modules/license-webpack-plugin/dist/LicenseTextReader.js:37:54)
    at PluginChunkReadHandler.processModule (~/scheduler/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:46:62)
    at ~/scheduler/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:22:23
    at WebpackModuleFileIterator.internalCallback (~/scheduler/node_modules/license-webpack-plugin/dist/WebpackModuleFileIterator.js:25:13)
    at WebpackModuleFileIterator.iterateFiles (~/scheduler/node_modules/license-webpack-plugin/dist/WebpackModuleFileIterator.js:10:9)
    at ~/scheduler/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:20:32
    at WebpackChunkModuleIterator.iterateModules (~/scheduler/node_modules/license-webpack-plugin/dist/WebpackChunkModuleIterator.js:42:21)
    at PluginChunkReadHandler.processChunk (~/scheduler/node_modules/license-webpack-plugin/dist/PluginChunkReadHandler.js:19:29)
    at _loop_1 (~/scheduler/node_modules/license-webpack-plugin/dist/WebpackCompilerHandler.js:92:37)
    at WebpackCompilerHandler.iterateChunks (~/scheduler/node_modules/license-webpack-plugin/dist/WebpackCompilerHandler.js:127:17)
    at ~/scheduler/node_modules/license-webpack-plugin/dist/WebpackCompilerHandler.js:43:31
    at fn (~/scheduler/node_modules/webpack/lib/Compilation.js:425:10)
    at _next6 (eval at create (~/scheduler/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:26:1)

System information Angular v12 Node 12.x

Additional context With Angular v11 CLI, our project uses the custom webpack angular builders to provide additional customisation to the webpack build where we use the svg spritemap plugin. Below is the config we use for the plugin which worked fine. Earlier we were using the version 3.x and it produces the same issue with Angular v12 so I tried updating to the latest version 4.0.2 but the issue is still present.

 new SVGSpritemapPlugin(helpers.root('src/assets/icons/**/*.svg'), {
            output: {
                filename: 'assets/svg/oss-icons-def.svg',
                chunk: {
                    keep: true,
                },
                svgo: false,
            },
            sprite: {
                prefix: 'icon-',
            },
        })

When I remove this plugin setup from my custom webpack config, the angular build works fine but when I add this plugin I get the error mentioned above.

Any help would be appreciated thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jeetparikhcommented, May 20, 2021

hey @cascornelissen thanks for getting back. I will try and see if I can create a repo with minimal extraction - just a bit tricky since it would need a lot of extraction and ensure a minimal version. Do you see anything obvious in the config that could be wrong? or anything that could be breaking? Just a hunch or anything I could try? Thanks

0reactions
cascornelissencommented, Nov 3, 2021

Hi @SlavikUst, without a reproduction repository or at least a stacktrace it would just be a guessing game for me so unless you’re able to provide additional details I’m afraid you’re on your own.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HookWebpackError: ENOENT: no such file or directory ...
HookWebpackError : ENOENT: no such file or directory, scandir at makeWebpackError while trying to run storybook #7929.
Read more >
Error: ENOENT: no such file or directory, scandir
I got the error 'Error: ENOENT: no such file or directory, scandir '**/node_modules/node-sass/vendor', this solution helped me resolve it.
Read more >
Fix "no such file or directory, scandir" - David Walsh Blog
After 15+ years in the web development industry, and seeing the landscape of tooling change, I've really lost patience with tooling errors.
Read more >
Error: ENOENT: no such file or directory, scandir ... - YouTube
nodejsError: ENOENT : no such file or directory, scandir '**/node_modules/node-sass/vendor' | Module build failed (from .
Read more >
ENOENT: no such file or directory, scandir at ... - Issuehunt
HookWebpackError : ENOENT: no such file or directory, scandir at makeWebpackError while trying to run storybook #16755. innoveltec posted onGitHub.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found