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

ENOENT: No such file or directory, scandir (only on windows) #124

Open
StuderAaron opened this issue May 23, 2022 · 5 comments
Open

ENOENT: No such file or directory, scandir (only on windows) #124

StuderAaron opened this issue May 23, 2022 · 5 comments

Comments

@StuderAaron
Copy link

I get the following Error, when using the plugin on windows (on linux everything works fine):

[webpack-cli] HookWebpackError: ENOENT: no such file or directory, scandir
at makeWebpackError (C:\myPath\www\node_modules\webpack\lib\HookWebpackError.js:48:9)
at C:\myPath\www\node_modules\webpack\lib\Compilation.js:3060:12
at eval (eval at create (C:\myPath\www\node_modules\tapable\lib\HookCodeFactory.js:33:10), :23:1)
at fn (C:\myPath\www\node_modules\webpack\lib\Compilation.js:480:17)
at _next10 (eval at create (C:\myPath\www\node_modules\tapable\lib\HookCodeFactory.js:33:10), :21:1)
at eval (eval at create (C:\myPath\www\node_modules\tapable\lib\HookCodeFactory.js:33:10), :37:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
-- inner error --
Error: ENOENT: no such file or directory, scandir
at Object.readdirSync (node:fs:1420:3)
at CacheBackend.provideSync (C:\myPath\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:233:32)
at WebpackFileSystem.listPaths (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackFileSystem.js:78:24)
at LicenseTextReader.readLicense (C:\myPath\www\node_modules\license-webpack-plugin\dist\LicenseTextReader.js:37:54)
at PluginChunkReadHandler.processModule (C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:71:62)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:24:27
at WebpackInnerModuleIterator.internalCallback (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:39:13)
at WebpackInnerModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:21:9)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:20:39
at WebpackChunkModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackChunkModuleIterator.js:42:21)
caused by plugins in Compilation.hooks.processAssets
Error: ENOENT: no such file or directory, scandir
at Object.readdirSync (node:fs:1420:3)
at CacheBackend.provideSync (C:\myPath\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:233:32)
at WebpackFileSystem.listPaths (C:\Users\aastuder\Documents\projects\sharedlogic\eclipse-4_13_0-core\belimo-shared-logic.core\ch.belimo. at LicenseTextReader.readLicense (C:\myPath\www\node_modules\license-webpack-plugin\dist\LicenseTextReader.js:37:54)
at PluginChunkReadHandler.processModule (C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:71:62)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:24:27
at WebpackInnerModuleIterator.internalCallback (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:39:13)
at WebpackInnerModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackInnerModuleIterator.js:21:9)
at C:\myPath\www\node_modules\license-webpack-plugin\dist\PluginChunkReadHandler.js:20:39
at WebpackChunkModuleIterator.iterateModules (C:\myPath\www\node_modules\license-webpack-plugin\dist\WebpackChunkModuleIterator.js:42:21)

The problem seems to be, that the path is empty (in CachedInputFileSystem:provideSync).
Any Ideas?

@williamjacobszoon
Copy link

What I found was that package.json was include as a module. When LicenseTextReader.prototype.readLicense (LicenseTextReader.js) executes it fails as module.directory is an empty string. As the fix I added the below highlighted line.

Not sure whether this is the correct fix.

image

@WorldMaker
Copy link

WorldMaker commented Jul 19, 2022

Found an immediate workaround for now:

  new LicenseWebpackPlugin({
      excludedPackageTest(packageName) {
        return packageName === '<this module name>'
      },
  })

(EDIT: Debugged the logic here. Agree with @williamjacobszoon that the inclusion seems to be because of the own module's inclusion [where module.name === to the name in package.json] with a module.directory === ''.)

@christopherboyd
Copy link

We ran into this issue when using both html-webpack-plugin and license-webpack-plugin in our project.

@stritti
Copy link

stritti commented Nov 7, 2022

      excludedPackageTest(packageName) {
        return packageName === '<this module name>'
      },

Hi @WorldMaker, in which way you found the name of the causing modul?

@WorldMaker
Copy link

@stritti I believe I recall that was some old fashioned console.log debugging. I think I started with a return true in that callback, with a console.log(packageName) and started at the bottom of the list until the error went away.

philippfromme added a commit to camunda/camunda-modeler that referenced this issue Jan 5, 2023
lzgabel pushed a commit to lzgabel/camunda-modeler that referenced this issue Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants