Fix clean task Error: ENOTEMPTY: directory not empty, rmdir#1911
Merged
Conversation
|
colinrotherham
commented
Apr 29, 2026
| ], | ||
| "scripts": { | ||
| "clean": "del-cli dist", | ||
| "clean": "del-cli dist/nhsuk/*", |
Contributor
Author
There was a problem hiding this comment.
The del package doesn't set maxRetries when removing files or directories
But updating the glob dist → dist/nhsuk/* splits out multiple paths to delete which appears to solve the problem (i.e. smaller batched deletes rather than one large delete)
colinrotherham
commented
Apr 29, 2026
| */ | ||
| export function getNames() { | ||
| const listing = files.getDirectories('nhsuk/components', { | ||
| const listing = files.getListing('nhsuk/components/*/template.njk', { |
Contributor
Author
There was a problem hiding this comment.
This change fixes an issue where switching branches would leave empty directories behind, which then causes errors when trying to run file operations or build tasks on them
E.g. packages/nhsuk-frontend/src/nhsuk/components/search-input
frankieroberto
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR is a workaround to an issue with Node.js
fsPromises.rm()where deleting large directories such aspackages/nhsuk-frontend/distthrowsENOTEMPTYor other errors when the file system is busyChecklist