Skip to content
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

pnpm rebuild not working when node-linker=hoisted #5560

Closed
balajiv113 opened this issue Oct 28, 2022 · 2 comments · Fixed by #5811
Closed

pnpm rebuild not working when node-linker=hoisted #5560

balajiv113 opened this issue Oct 28, 2022 · 2 comments · Fixed by #5811
Assignees
Milestone

Comments

@balajiv113
Copy link

balajiv113 commented Oct 28, 2022

pnpm version:

pnpm - 7.14.0

Code to reproduce the issue:

https://github.com/balajiv113/pnpm-test

Expected behavior:

pnpm rebuild should build native modules even when node-linker=hoisted

Actual behavior:

pnpm rebuild not running as expected node-linker=hoisted

Additional information:

  • macOS - intel machine

Due to this issue, we are not able to do build electron application using electron-builder for multiple architectures (generating arm apps in intel and vice-versa). The app gets built, but the native binaries are on wrong architecture

@zkochan
Copy link
Member

zkochan commented Nov 1, 2022

Looks like the rebuild command can only lookup packages inside the node_modules/.pnpm directory as of now:

const pkgSnapshot = pkgSnapshots[depPath]
const pkgInfo = nameVerFromPkgSnapshot(depPath, pkgSnapshot)
const pkgRoot = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules', pkgInfo.name)
try {
const modules = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules')
const binPath = path.join(pkgRoot, 'node_modules', '.bin')
await linkBins(modules, binPath, { extraNodePaths: ctx.extraNodePaths, warn })
await runPostinstallHooks({

Why do you need the rebuild command at all? The deps are built on pnpm install.

@balajiv113
Copy link
Author

Electron builder makes use of this rebuild command to rebuild the native dependency for different arch.

Due to this issue, for all arch (amd64, arm64) the native dependency are compiled to only to one (amd64).

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

Successfully merging a pull request may close this issue.

2 participants