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

Create asar fails for nested empty directories: Cannot read property 'files' of undefined #245

Closed
mmaietta opened this issue Oct 26, 2022 · 1 comment · Fixed by #246
Closed
Labels

Comments

@mmaietta
Copy link

Version: 3.2.0

This can be easily reproduced by having a folder structure below:

  • out
    • scripts
      • main.js
      • preload.js
      • renderer.js

This is notably a big issue as it also causes #144, where scoped modules are often a "double-stack" of folders, the scope being an empty root folder for the package subfolder

I'm using asar programmatically. With the above folder structure, I'm simply doing:

const options: CreateOptions = {
      pattern: `/out/**/*`
}
await createPackageWithOptions(path.resolve(this.src), this.outFile, options)

For my project, I do have the ability to change the file/folder structure. But we're fully blocked when it comes to scoped node_modules
Stacktrace:

  ⨯ TypeError: Cannot read property 'files' of undefined
    at Filesystem.searchNodeFromPath (/eb-test/node_modules/asar/lib/filesystem.js:37:14)
    at Filesystem.insertDirectory (/eb-test/node_modules/asar/lib/filesystem.js:47:23)
    at handleFile (/eb-test/node_modules/asar/lib/asar.js:118:20)
    at next (/eb-test/node_modules/asar/lib/asar.js:148:11)
    at Object.module.exports.createPackageFromFiles (/eb-test/node_modules/asar/lib/asar.js:152:10)
    at Object.module.exports.createPackageWithOptions (/eb-test/node_modules/asar/lib/asar.js:40:25)
@continuous-auth
Copy link

🎉 This issue has been resolved in version 3.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants
@mmaietta and others