Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

fix: better support of .node files #1321

Merged
merged 5 commits into from
Sep 30, 2021
Merged

fix: better support of .node files #1321

merged 5 commits into from
Sep 30, 2021

Conversation

robertsLando
Copy link
Contributor

@robertsLando robertsLando commented Sep 29, 2021

When a .node file is required pkg copies it in a temporary folder like /tmp/<hash>/addon.node the problem is that for modules like sharp this isn't working as them are statically linked to other .so files using relative paths. This pr will copy the entire module folder inside the temporary directory, this allows also to remove the tryImport function as there is no reason to try again if that fails.

I tested this on my end and it's working

I also grouped all hash folders inside pkg folder to be sure that the copy will run when users will update pkg, otherwise the copy may not be done when the folder already exists but was created with a previous pkg version

cc @jesec @leerob @erossignon

Fixes #1075

@robertsLando
Copy link
Contributor Author

@leerob Could you take a look into this please? If it looks ok to you could you also make a patch release? I need this in a project I'm working on, thannks :)

prelude/bootstrap.js Outdated Show resolved Hide resolved
prelude/bootstrap.js Show resolved Hide resolved
prelude/bootstrap.js Outdated Show resolved Hide resolved
@leerob
Copy link
Member

leerob commented Sep 30, 2021

Thanks for the review, @jesec! 🙏

@jesec jesec merged commit 165617a into main Sep 30, 2021
@jesec jesec deleted the fix#1075 branch September 30, 2021 17:32
@robertsLando
Copy link
Contributor Author

robertsLando commented Oct 1, 2021

@leerob new patch when possible please 🙏🏼

@ghost
Copy link

ghost commented Oct 11, 2021

Thank u for this patch. But now i have the following error.

Something went wrong installing the "sharp" module

Cannot read property '1' of null

Possible solutions:
- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"
- Install for the current runtime: "npm install --platform=win32 --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install

Could you plase help me?

@robertsLando
Copy link
Contributor Author

Fixed on master

@plckr
Copy link

plckr commented Nov 4, 2021

@Grewamor I'm having the same problem, and since I'm using yarn I don't know how can I install it to specific platform and arch, AFAIK yarn makes it impossible to choose

@chuongmep
Copy link

Any update for now ? I'm facing with same issue
image

@benjaminhera
Copy link

Any updates on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundling sharp doesn't work anymore since updating to 4.5.0
6 participants