Skip to content

Ignore directories when searching for npm/node executables - #3199

Open
ARAYN7011 wants to merge 2 commits into
diffplug:mainfrom
ARAYN7011:fix-npm-finder-directory-3190
Open

ARAYN7011 wants to merge 2 commits into
diffplug:mainfrom
ARAYN7011:fix-npm-finder-directory-3190

Conversation

@ARAYN7011

Copy link
Copy Markdown
Contributor

Fixes #3190

File.canExecute() is true for directories, so a folder named npm inside a NODE_PATH entry (as in the reporter's container) was picked as the npm executable, and the node lookup then failed with "Can't automatically determine node executable". FileFinder's executable filter now requires a regular file. NODE_PATH is still searched, so existing setups keep working.

Test plan

  • New FileFinderTest: a directory named npm is not found (fails before the fix, passes after); a real executable file still is.
  • ./gradlew :testlib:test --tests '*FileFinderTest', :lib:spotlessCheck, :testlib:spotlessCheck pass.
  • Added a CHANGES.md entry.

AI disclosure: this change was prepared with AI assistance (Claude Code) and reviewed/tested before submitting.

🤖 Generated with Claude Code

ARAYN7011 and others added 2 commits November 21, 2026 10:14
A directory such as NODE_PATH/npm passes File.canExecute(), so it was
picked as the npm executable. Require a regular file.

Fixes diffplug#3190

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: ARAYN7011 <88572149+ARAYN7011@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: ARAYN7011 <88572149+ARAYN7011@users.noreply.github.com>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Error: Spotless looks for 'node' and 'npm' in $NODE_PATH, finds a folder called 'npm' and mistakes it for the executable

1 participant