Repository navigation
Commit 0749395
committed
Fix the desktop install shipping an empty node_modules
Reported from a real install:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@diskpush/database'
imported from ~/.local/share/diskpush/app/resources/cli/dist/bin.js
Two bugs compounding, neither visible in the artifact I checked.
Node's `fs.cpSync` resolves relative symlinks to absolute paths unless
`verbatimSymlinks` is set. Copying the staged CLI into the app therefore
rewrote pnpm's good `../.pnpm/...` links as absolute paths into this script's
temp directory - which the same script deletes in its finally block. The links
were dangling before packaging even started.
electron-builder's extraResources copy then silently produced nothing for
those broken links, so the shipped app had `resources/cli/node_modules`
present but empty. The CLI-only tarball was unaffected: tar preserved the
relative links, which is why that path installed and ran fine and this went
unnoticed.
Fixed at the root rather than by repairing the links: the deploy now uses
`--config.node-linker=hoisted`, so the bundle is plain directories with zero
symlinks - same 33MB - and survives any copy, including whatever
electron-builder does to it. `verbatimSymlinks: true` is set as well so the
copy cannot reintroduce the problem.1 parent 26e8239 commit 0749395
2 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
81 | 92 | | |
82 | 93 | | |
83 | 94 | | |
| |||
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
91 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
92 | 106 | | |
93 | 107 | | |
94 | 108 | | |
| |||
0 commit comments