ITADN

`node inspect` hides `inspect.js` script without warning

#64111Closedvassudanagunta 创建于 2026-06-24
V
vassudanaguntacommented
### Version v26.3.0 ### Subsystem node inspect ### What steps will reproduce the bug? ```shell echo "console.log('executing respect.js')" > respect.js echo "console.log('executing inspect.js')" > inspect.js node respect arg node inspect arg ``` ### What is the expected behavior? Why is that the expected behavior? Either a hard error: ```shell $ node respect arg executing respect.js $ node inspect arg AMBIGUITY ERROR: A script named "inspect.js" exists in the current directory. Unsure whether user intends to run the script or invoke the Node debugger. To run the script, use "node inspect.js". To run the debugger, the script must first be renamed. ``` or a warning: ```shell $ node inspect arg WARNING: The 'inspect' subcommand is overriding the script "inspect.js" in the current directory. To execute the script, use "node test.js". (debugger output starts here) ``` Reason: See - https://github.com/nodejs/node/pull/52190#pullrequestreview-1968299083 - https://github.com/nodejs/node/issues/53483#issuecomment-2173398972 - #52267 ### What do you see instead? ```shell $ node respect arg executing respect.js $ node inspect arg < Debugger listening on ws://127.0.0.1:9229/3361b133-b551-4d82-954d-9f3b73993558 < For help, see: https://nodejs.org/learn/getting-started/debugging < < Debugger attached. < ok < Waiting for the debugger to disconnect... < debug> ``` ### Additional information _No response_
关闭于 2026-07-12 4 条评论