-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
node_gyp_bins
causes build failures in downstream packages
#2713
Comments
I am working on an electron project and running into this issue too. Though this only occurs when I use electron-packager (via electorn-forge) with asar enabled. Any temporary workaround? |
I'm also hitting this issue in an Electron project, it's breaking my build completely due to this dangling symlink. As an alternative to moving this path, could this symlink just be cleaned up after the build is completed? I can see how this is useful during the build process, but it doesn't seem like there's any good reason for it to persist afterwards. |
Another report of problems caused by this issue from stack overflow: https://stackoverflow.com/questions/73216989/electron-forge-throws-python3-8-links-out-of-the-package-error-when-makin |
From 2016: electron-userland/electron-builder#675 -- https://www.npmjs.com/package/asar-dev
Can we please see the |
In my case this I am building an Electron app and using Electron Builder, but the failure doesn't come from there at all, it comes from In my case, the specific command that finally fails for me is:
You can see the full error log in my CI build here: https://github.com/httptoolkit/httptoolkit-desktop/runs/7883734525?check_suite_focus=true. In this case, my The It's impossible to codesign any app for Mac that contains symlinks outside the codebase like this, so these links completely break my build. I think Apple is acting reasonably in rejecting this, I agree that a distributable app generally shouldn't contain absolute links to external locations on the filesystem. Even if they're weren't correct though, Apple is not likely to change this behaviour any time soon. This will affect any For now I've fixed this by manually scanning for all |
I would recommend reading thru https://github.com/txoof/codesign (which is written in Python) and then opening an issue on that repo if you still do not have a resolution. |
@cclauss I'm not using that package, I'm using Apple's own codesign binary. There's more info here: https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW3. To be clear: Codesign is working correctly in this case. It is rejecting bad input from node-gyp. I want this error - I do not want to codesign my /usr/bin/python binary. Similarly, people who are bundling node_modules usually do want that to fail if they accidentally include symlinks to other parts of the system outside their codebase. This is not a problem with codesign or anything else. Node-gyp is now leaving behind absolute symlinks in node_modules. This will cause problems with many tools, but particularly for people building any kind of distributable applications. Node-gyp should not leave absolute symlinks like this in node_modules after the build is completed. Is there a specific reason that leaving these links after the build completes is useful? Would there be any downside to removing them? I'm happy to open a PR to do so and fix this issue, if that would be accepted. |
Well explained. I now understand. I think your pull request would be the right path forward. Let's try to remove the absolute symlinks in node_modules and see where that takes us. |
Ok, great, I'll do that now |
Create a PR to fix this here: #2721 Not quite as simple as described above, but the same end result. Since the symlinks were created in Instead, once we calculate the link path in |
There are 14 ffi-napi issues on this repo. Perhaps hints for a solution could be found by studying them. |
so add a whitelist to ignore links out of the package ?? |
install.sh error out with: /usr/lib/node_modules/asar/lib/filesystem.js:101 throw new Error(`${p}: file "${link}" links out of the package`) ^ Error: app/node_modules/abstract-socket/build/node_gyp_bins/python3: file "../../../../../../../../usr/bin/python3.10" links out of the package at Filesystem.insertLink (/usr/lib/node_modules/asar/lib/filesystem.js:101:13) at handleFile (/usr/lib/node_modules/asar/lib/asar.js:132:20) at next (/usr/lib/node_modules/asar/lib/asar.js:148:11) at next (/usr/lib/node_modules/asar/lib/asar.js:149:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) workaround it by removing this symlink before calling "asar pack app app.asar". The upstream issue is not fixed yet: nodejs/node-gyp#2713 "node_gyp_bins causes build failures in downstream packages"
deeze.sh -b error out with: /usr/local/lib/node_modules/asar/lib/filesystem.js:101 throw new Error(`${p}: file "${link}" links out of the package`) ^ Error: app/node_modules/abstract-socket/build/node_gyp_bins/python3: file "../../../../../../../../../../../usr/bin/python3.10" links out of the package at Filesystem.insertLink (/usr/local/lib/node_modules/asar/lib/filesystem.js:101:13) at handleFile (/usr/local/lib/node_modules/asar/lib/asar.js:132:20) at next (/usr/local/lib/node_modules/asar/lib/asar.js:148:11) at next (/usr/local/lib/node_modules/asar/lib/asar.js:149:12) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) workaround it by removing this symlink before calling "asar pack app app.asar". The upstream issue is not fixed yet: nodejs/node-gyp#2713 "node_gyp_bins causes build failures in downstream packages"
Thanks for looking at this. This issue also causes some impressive side-effects when using electron-forge and osx codesign. Because node-gyp leaves behind symlinks to python3, electron-builder will use osx codesign to sign the python binary while processing the app, breaking your system python install (because of resulting sig mismatch). I am wiping node_gyp_bins manually in a build/package hook as a workaround for now, but would be great to get this resolved properly. |
Would love to see a fix for this. |
Hello. Thanks for the good work on node-gyp. I wanted the check in on this. I was finding that the rush package manager's |
When you want a pull request to be merged, please give it a positive review as @DeeDeeG has done at the top right of this page. Every checkmark ✔️ that project maintainers see there gives them confidence that the proposed changes have been looked at and have been deemed both useful and safe to merge into the codebase. Lots of "what is the ETA?" comments are easier for maintainers to ignore than ✔️✔️✔️✔️✔️ from several different reviewers. Anyone can review a pull request on GitHub. To do so here:
|
Sounds good! Happy to help! I know not all maintainers like this, but good to know here. |
I have never seen that. If they want to turn off the code review capability for non-maintainers then they are free to do so. |
If you are using electron-packager or electron-forge, you might encounter the following error : An unhandled rejection has occurred inside Forge: Error: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-x64/electron-example-darwin-x64-5AYzr2/Electron.app/Contents/Resources/app/node_modules/macos-alias/build/node_gyp_bins/python3: file "../../../../../../../../../../../../../Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11" links out of the package This error is showing when trying to package an electron application for macOS with Electron Forge. It takes its root in electron-packager and is produced by node-gyp like described in this Github issue. nodejs/node-gyp#2713
If you are using electron-packager or electron-forge, you might encounter the following error : An unhandled rejection has occurred inside Forge: Error: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-x64/electron-example-darwin-x64-5AYzr2/Electron.app/Contents/Resources/app/node_modules/macos-alias/build/node_gyp_bins/python3: file "../../../../../../../../../../../../../Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11" links out of the package This error is showing when trying to package an electron application for macOS with Electron Forge. It takes its root in electron-packager and is produced by node-gyp like described in this Github issue. nodejs/node-gyp#2713
If you are using electron-packager or electron-forge, you might encounter the following error : An unhandled rejection has occurred inside Forge: Error: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/electron-packager/darwin-x64/electron-example-darwin-x64-5AYzr2/Electron.app/Contents/Resources/app/node_modules/macos-alias/build/node_gyp_bins/python3: file "../../../../../../../../../../../../../Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11" links out of the package This error is showing when trying to package an electron application for macOS with Electron Forge. It takes its root in electron-packager and is produced by node-gyp like described in this Github issue. nodejs/node-gyp#2713
Hey folks! I'm a maintainer of
electron-packager
andelectron-rebuild
. We're seeing an issue with rebuilding native modules using node-gyp, that we think we introduced by this change: b9ddcd5 .When trying to rebuild a native module using Electron and node-gyp 9.0.0+, rebuilding will fail for older versions of python or folks using a python version manager with this error:
The link to the specific issue, with more details, is here: electron/rebuild#1024
We can handle this error inside electron-packager by ignoring the directory, but would it be possible to move this symlink directory outside of
node_modules
and into something like a tmp dir?I wasn't sure if the directory being in node_modules may cause other issues with other downstream users/packages, and thought we'd err on the side of reporting it 🙂 If there's a technical reason why it needs to be included in node_modules, please feel free to close this.
Thanks for your time!
The text was updated successfully, but these errors were encountered: