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

Error in getNode while accessing symlink #310

Closed
rmartins90 opened this issue Apr 1, 2024 · 1 comment
Closed

Error in getNode while accessing symlink #310

rmartins90 opened this issue Apr 1, 2024 · 1 comment
Labels

Comments

@rmartins90
Copy link

rmartins90 commented Apr 1, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @electron/[email protected] for the project I'm working on.

Here's the error I was having, it happened while accessing symlink in macOS library.

 Cannot read properties of undefined (reading 'Resources')  failedTask=build stackTrace=TypeError: Cannot read properties of undefined (reading 'Resources')
    at Filesystem.getNode (<...>/node_modules/@electron/asar/lib/filesystem.js:141:24)
    at Filesystem.getFile (<...>/node_modules/@electron/asar/lib/filesystem.js:149:23)
    at Filesystem.getFile (<...>/node_modules/@electron/asar/lib/filesystem.js:157:19)
    at Object.module.exports.statFile (<...>/node_modules/@electron/asar/lib/asar.js:157:21)
    at buildUnpacked (<...>/node_modules/@electron/universal/src/asar-utils.ts:101:25)
    at Object.exports.mergeASARs (<...>/node_modules/@electron/universal/src/asar-utils.ts:114:3)
    at exports.makeUniversalApp (<...>/node_modules/@electron/universal/src/index.ts:235:13)
    at MacPackager.doPack (<...>/node_modules/app-builder-lib/src/macPackager.ts:140:9)
    at MacPackager.pack (<...>/node_modules/app-builder-lib/src/macPackager.ts:188:9)
    at Packager.doBuild (<...>/node_modules/app-builder-lib/src/packager.ts:445:9)
    at executeFinally (<...>/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (<...>/node_modules/app-builder-lib/src/packager.ts:379:31)
    at Packager.build (<...>/node_modules/app-builder-lib/src/packager.ts:340:12)
    at executeFinally (<...>/node_modules/builder-util/src/promise.ts:12:14)

Here is the diff that solved my problem:

diff --git a/node_modules/@electron/asar/lib/filesystem.js b/node_modules/@electron/asar/lib/filesystem.js
index 27b00a1..82d01ef 100644
--- a/node_modules/@electron/asar/lib/filesystem.js
+++ b/node_modules/@electron/asar/lib/filesystem.js
@@ -133,7 +133,7 @@ class Filesystem {
   getNode (p) {
     const node = this.searchNodeFromDirectory(path.dirname(p))
     const name = path.basename(p)
-    if (name) {
+    if (name && node.files && node.files[name])
       return node.files[name]
     } else {
       return node

This issue body was partially generated by patch-package.

@MarshallOfSound
Copy link
Member

Merging into #248

@MarshallOfSound MarshallOfSound closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants