You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't use this package directly, however I encountered this issue with the @electron-forge/maker-squirrel package. After some investigation I believe the issue resides within this package. The error in question is the following:
No dice: ENOENT: no such file or directory, open 'C:\Users\brand\AppData\Local\Temp\si-2024211-6524-qimd4y.k3l7a\@demo\electron-app.nuspec'
This step occurs when windows-installer is attempting to write the *.nuspec file to the temp directory.
The variable which appears to be linked to the error is the "name" key inside of package.json. When the name contains a "/" character the createWindowsInstaller function fails with the message included above. If the forward slash is removed from the name, the function produces no errors.
node's path.join() is trying to be clever when joining the path and replaces the "/" with a "\". When this path is used by fs.writeFile() on line 150 it is trying to write to a directory that does not exist.
Proposed Solution
As someone who is not very familiar with the low-level interworkings of native node-api's I wanted to present this issue to the maintainers prior to developing my own solution. A simple approach would be a regex to match & replace any of these known troublesome characters with a "-" (I see squirrel doesn't like this) or "_". This appears to be how electron-forge package is producing its artifacts. The output directory is named @demo-electron-app-{platform}-{arch}, aka they replaced "/" with "-". I would be happy to create a PR for this if this sounds like a good work around. I would assume since this is only a temp output directory the naming convention isn't too important.
The text was updated successfully, but these errors were encountered:
Background
I don't use this package directly, however I encountered this issue with the @electron-forge/maker-squirrel package. After some investigation I believe the issue resides within this package. The error in question is the following:
This step occurs when windows-installer is attempting to write the *.nuspec file to the temp directory.
Reproduce
Environment
Windows 11: 23H2
Node: v18.19.1
Npm: 10.2.4
I have created a repository which uses the base electron webpack template and includes steps for reproducing: https://github.com/brandonegg/electron-winstaller-demo?tab=readme-ov-file#environment
The variable which appears to be linked to the error is the "name" key inside of package.json. When the name contains a "/" character the
createWindowsInstaller
function fails with the message included above. If the forward slash is removed from the name, the function produces no errors.Analysis
I found this line:
windows-installer/src/index.ts
Line 148 in 598aa70
I believe this is the issue, specifically because of the following behavior which occurs with path.join().
node's path.join() is trying to be clever when joining the path and replaces the "/" with a "\". When this path is used by
fs.writeFile()
on line 150 it is trying to write to a directory that does not exist.Proposed Solution
As someone who is not very familiar with the low-level interworkings of native node-api's I wanted to present this issue to the maintainers prior to developing my own solution. A simple approach would be a regex to match & replace any of these known troublesome characters with a "-" (I see squirrel doesn't like this) or "_". This appears to be how electron-forge package is producing its artifacts. The output directory is named @demo-electron-app-{platform}-{arch}, aka they replaced "/" with "-". I would be happy to create a PR for this if this sounds like a good work around. I would assume since this is only a temp output directory the naming convention isn't too important.
The text was updated successfully, but these errors were encountered: