-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rush] Improve rush deploy
error message for symlinks outside of the source path
#3774
Comments
For context, it seems that the root issue we were running into was the same one described here: nodejs/node-gyp#2713 |
Any advice on how to fix this besides adding a step to find and delete these python3 symlinks before doing the deploy? Since rush treats stderr output as a failure, this is causing CI to fail for me in a few repos. |
Hey @mgabeler-lee-6rs , we had the same problem and until node-gyp fixes the issue on their end, we just run |
I took a stab at this with #4069 |
For anyone that's dealing with this, I recently ran into this issue (on rush 5.100.1) when trying to work with
and it worked like a charm. It makes your build more fragile to dependency changes ... but let's face it, node_gyp is the source of that fragility. This hack is just a bandaid around it. |
I ran into this issue again when additional deps in my dependency graph pulled in a symlink for const fs = require('fs').promises;
const path = require('path');
// Function to recursively traverse the directory
async function replacePython3(directory) {
const entries = await fs.readdir(directory, { withFileTypes: true });
for (let entry of entries) {
const fullPath = path.join(directory, entry.name);
if (entry.isDirectory()) {
// If the entry is a directory, recurse into it
await replacePython3(fullPath);
} else if ((entry.isFile() || entry.isSymbolicLink()) && entry.name === 'python3') {
// If the entry is a file or symlink named 'python3', replace it
try {
await fs.unlink(fullPath); // Remove the file or symlink
await fs.copyFile('/usr/bin/python3', fullPath); // Copy /usr/bin/python3 to the location
console.log(`Replaced python3 at: ${fullPath}`);
} catch (error) {
console.error(`Failed to replace python3 at: ${fullPath}`, error);
}
}
}
}
// Replace '/path/to/directory' with the actual path you want to search
replacePython3(__dirname + '/common/temp')
.then(() => {
console.log('Replacement process completed.');
})
.catch((error) => {
console.error('An error occurred:', error);
}); |
Summary
This is a feature request for improving the error message that is emitted when
rush deploy
encounters a symlink outside of the source path.After upgrading from Node 14.x to Node 16.x we started seeing the following error when running
rush deploy
:We were able to troubleshoot the issue, but it involved manually patching the installed
DeployManager.js
file to get the information needed to the debug the problem.Details
Running
rush --debug deploy
yielded the following stack trace:In order to track down the dependency causing the error we had to manipulate the installed
DeployManager.js
file to add additional logging, which eventually led us to the issue being this symlink:/tmp/build_202c776f/common/temp/node_modules/.pnpm/[email protected]/node_modules/unix-dgram/build/node_gyp_bins/python3
to/usr/bin/python3
This was done by logging the
absoluteLinkInfo.linkPath
andabsoluteLinkInfo.targetPath
located here:rushstack/libraries/rush-lib/src/logic/deploy/DeployManager.ts
Lines 585 to 589 in 199011d
It would be nice if there was some additional logging built-in that would allow for debugging issues like this without having to resort to tampering with the installed JavaScript files.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/rush
globally installed version?rushVersion
from rush.json?useWorkspaces
from rush.json?node -v
)?The text was updated successfully, but these errors were encountered: