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

TypeError: DirectoryWatcher is not a constructor #118

Closed
msogrin opened this issue Jul 31, 2019 · 4 comments
Closed

TypeError: DirectoryWatcher is not a constructor #118

msogrin opened this issue Jul 31, 2019 · 4 comments

Comments

@msogrin
Copy link

msogrin commented Jul 31, 2019

We have a repeating error appearing when running tests of our application (using jest, if it matters; using the project set up via https://github.com/react-boilerplate/react-boilerplate). Is this error caused by our (or react-boilerplate) misconfiguration somewhere, or it is a problem in watchpack itself?

/app/node_modules/watchpack/lib/watcherManager.js:18
                this.directoryWatchers[key] = new DirectoryWatcher(directory, options);
                                              ^

TypeError: DirectoryWatcher is not a constructor
    at WatcherManager.Object.<anonymous>.WatcherManager.getDirectoryWatcher (/app/node_modules/watchpack/lib/watcherManager.js:18:33)
    at WatcherManager.watchFile (/app/node_modules/watchpack/lib/watcherManager.js:28:14)
    at Watchpack.<anonymous> (/app/node_modules/watchpack/lib/watchpack.js:38:49)
    at Array.map (<anonymous>)
    at Watchpack.watch (/app/node_modules/watchpack/lib/watchpack.js:37:28)
    at NodeWatchFileSystem.watch (/app/node_modules/webpack/lib/node/NodeWatchFileSystem.js:70:16)
    at Watching.watch (/app/node_modules/webpack/lib/Watching.js:113:48)
    at compiler.hooks.done.callAsync (/app/node_modules/webpack/lib/Watching.js:100:10)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/app/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/app/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._done (/app/node_modules/webpack/lib/Watching.js:97:28)
    at compiler.emitRecords.err (/app/node_modules/webpack/lib/Watching.js:72:19)
    at Compiler.emitRecords (/app/node_modules/webpack/lib/Compiler.js:449:39)
    at compiler.emitAssets.err (/app/node_modules/webpack/lib/Watching.js:53:20)
    at hooks.afterEmit.callAsync.err (/app/node_modules/webpack/lib/Compiler.js:435:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/app/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/app/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
    at asyncLib.forEachLimit.err (/app/node_modules/webpack/lib/Compiler.js:432:27)
    at /app/node_modules/neo-async/async.js:2813:7
    at done (/app/node_modules/neo-async/async.js:3521:9)
    at MemoryFileSystem.Object.<anonymous>.MemoryFileSystem.writeFile (/app/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
    at writeOut (/app/node_modules/webpack/lib/Compiler.js:415:30)
    at asyncLib.forEachLimit (/app/node_modules/webpack/lib/Compiler.js:426:7)
    at objectIteratorWithKey (/app/node_modules/neo-async/async.js:3508:9)
    at timesSync (/app/node_modules/neo-async/async.js:2292:7)
    at Object.eachLimit (/app/node_modules/neo-async/async.js:3463:5)
    at emitFiles (/app/node_modules/webpack/lib/Compiler.js:321:13)
    at Immediate._onImmediate (/app/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
@angelyaaaaa
Copy link

I got same situation when I doing endpoint test through jest, but I got other error as detail :
setInterval(...).unref is not a function

then I found this: TypeError: timer.unref is not a function which solves my problems.

hope it helps

@toearth
Copy link

toearth commented Feb 24, 2020

+1

TypeError: DirectoryWatcher is not a constructor

  at WatcherManager.Object.<anonymous>.WatcherManager.getDirectoryWatcher (node_modules/watchpack/lib/watcherManager.js:18:33)
  at WatcherManager.watchFile (node_modules/watchpack/lib/watcherManager.js:28:14)
  at Watchpack.<anonymous> (node_modules/watchpack/lib/watchpack.js:38:49)
      at Array.map (<anonymous>)
  at Watchpack.watch (node_modules/watchpack/lib/watchpack.js:37:28)
  at NodeWatchFileSystem.watch (node_modules/webpack/lib/node/NodeWatchFileSystem.js:70:16)
  at Watching.watch (node_modules/webpack/lib/Watching.js:114:48)
  at compiler.hooks.done.callAsync (node_modules/webpack/lib/Watching.js:101:10)
  at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:87:1)
  at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
  at Watching._done (node_modules/webpack/lib/Watching.js:98:28)
  at compiler.emitRecords.err (node_modules/webpack/lib/Watching.js:73:19)
  at Compiler.emitRecords (node_modules/webpack/lib/Compiler.js:499:39)
  at compiler.emitAssets.err (node_modules/webpack/lib/Watching.js:54:20)
  at hooks.afterEmit.callAsync.err (node_modules/webpack/lib/Compiler.js:485:14)
  at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:1)

`

@Ghirigoro
Copy link

Same error here while using Jest and koa-webpack.

@alexander-akait
Copy link
Member

I think we can close it, DirectoryWatcher is not a constructor when you doesn't close webpack-dev-middleware and still try to use it (you can see it in stack trace)

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