-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
watch-modeIssues and PRs related to watch modeIssues and PRs related to watch mode
Description
Version
v18.16.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
internal/watch_mode/files_watcher.js
What steps will reproduce the bug?
Use node --watch script.js
How often does it reproduce? Is there a required condition?
When third-party tool written in Java works on the same directory.
What is the expected behavior? Why is that the expected behavior?
Normal running.
What do you see instead?
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
at new NodeError (node:internal/errors:399:5)
at validateString (node:internal/validators:163:11)
at resolve (node:path:167:9)
at FSWatcher.<anonymous> (node:internal/watch_mode/files_watcher:94:30)
at FSWatcher.emit (node:events:513:28)
at FSWatcher._handle.onchange (node:internal/fs/watchers:215:12) {
code: 'ERR_INVALID_ARG_TYPE'
}
Additional information
The reason for the error is the call resolve
without checking if the name is not null
node/lib/internal/watch_mode/files_watcher.js
Lines 93 to 94 in 9398ff1
watcher.on('change', (eventType, fileName) => this | |
.#onChange(recursive ? resolve(path, fileName) : path)); |
Regardles to documentation:
filename is not always guaranteed to be provided. Therefore, don't assume that filename argument is always provided in the callback, and have some fallback logic if it is null.
MoLow, cinderblock, Schmavery and rotu
Metadata
Metadata
Assignees
Labels
watch-modeIssues and PRs related to watch modeIssues and PRs related to watch mode