Our project makes use of local NPM packages, such as:
"dependencies": {
...
"node-ci": "./submodules/node-ci",
...
}
This creates a shortcut in Windows in the node_modules folder that links to the actual package (see below):
Our pipeline build runs through and completes, but errors out and leaves the runner in an unhealthy state because it tries to delete both folders and fails:
[2025-01-10 11:19:49,974] An error occurred whilst tearing down directories.
java.nio.file.NoSuchFileException: C:\Users\...\atlassian-bitbucket-pipelines-runner\bin\..\temp\5acf5a6b-f269-50f7-b1a5-9e66afd53479\1736525790831\build\node_modules\node-ci
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
.....
[2025-01-10 11:19:49,974] Cancelling timeout
[2025-01-10 11:19:49,974] Updating runner state to "UNHEALTHY".
[2025-01-10 11:19:50,146] Completing step with result Result{status=FAILED, error=Some(Error{key='runner.working-directory-teardown-error', message='An error occurred while attempting to clean the build folder. Check the runner logs and manually clean up the build folder on the host machine to fix this issue.', arguments={}})}.
This pretty much eliminates our ability to utilize pipelines. Is there a known workaround?
Hi Brendan and welcome to the community!
At the end of each Pipelines step, the runner cleans up build directories before running the next step. If the runner can’t perform this cleanup, it will enter an unhealthy state.
Is node-ci a shortcut or a symlink?
There is a bug with the windows runner being sometimes unable to clean the build directory when symlinks are present. The bug occurs when the name of the symlink comes after the name of the directory that the symlink is pointing to in alphabetical order. We have a bug report about this here:
If you are using a symlink and are affected by this bug, please select the link This affects my team in the bug report to indicate you are affected by this issue. You can also add yourself as a watcher (by selecting the link Start watching this issue in the bug report) if you'd like to get notified via email on any updates.
The workaround is to add an after-script in the step and delete the symlink during the after-script.
I haven't been able to reproduce this issue with shortcuts though. If you are using a shortcut instead of a symlink, you can create a ticket with the support team so we can look into your build and investigate further. You can create a ticket via https://support.atlassian.com/contact/#/, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation.
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
Perhaps I should create a support request, as I believe this is something the runner should be able to handle gracefully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I’d recommend opening a ticket with Atlassian support at https://support.atlassian.com/contact/#/ for further assistance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Brendan Bates
Based on my understanding, the issue with Windows Pipeline Runner failing to clean up is likely caused by symlinks or shortcuts in your node_modules folder, which can interfere with cleanup scripts.
You might try adding a manual cleanup step to your pipeline configuration to delete symlinks before the runner attempts cleanup. Alternatively, adjusting the npm settings to avoid symlinks or using a different package management setup like yarn could help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.