forge icon indicating copy to clipboard operation
forge copied to clipboard

Still cannot make when package name is scoped (on Windows)

Open cwellsx opened this issue 1 year ago • 2 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project uses.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.2.0

Electron version

v28.1.0

Operating system

Windows 10 (version 22H2)

Last known working Electron Forge version

No response

Expected behavior

npm run male should run without error even when the name in the package.json is scoped e.g. like @cwellsx/apis

Actual behavior

[STARTED] Making distributables
*** appName is @cwellsx-apis
[STARTED] Making a squirrel distributable for win32/x64
[FAILED] ENOENT: no such file or directory, open 'C:\Users\CHRIST~1\AppData\Local\Temp\si-202409-9652-qovtfu.huiw\@cwellsx\apis.nuspec'
[FAILED] ENOENT: no such file or directory, open 'C:\Users\CHRIST~1\AppData\Local\Temp\si-202409-9652-qovtfu.huiw\@cwellsx\apis.nuspec'

An unhandled rejection has occurred inside Forge:
Error: ENOENT: no such file or directory, open 'C:\Users\CHRIST~1\AppData\Local\Temp\si-202409-9652-qovtfu.huiw\@cwellsx\apis.nuspec'

Steps to reproduce

First lines of package.json looks like this

{
  "name": "@cwellsx/apis",
  "productName": "",
  "version": "1.0.0",

Additional information

This was supposedly fix here I still see this problem:

I looked at the fix/commit linked to that issue, it seems to be mostly this:

const appName = filenamify(forgeConfig.packagerConfig.name || packageJSON.productName || packageJSON.name, { replacement: '-' });

I edited the node_modules\@electron-forge\core\dist\api\make.js to log the result of that line of code:

                const packageJSON = await (0, read_package_json_1.readMutatedPackageJson)(dir, forgeConfig);
                const appName = (0, filenamify_1.default)(forgeConfig.packagerConfig.name || packageJSON.productName || packageJSON.name, { replacement: '-' });
                console.log(`*** appName is ${appName}`)

As shown in the Actual behaviour above, that line of code is running as expected and filenameifying the name. However the make still fails.

I don't know how you tested your fix but, given the package.json you attached, perhaps you only tested it on linux.

cwellsx avatar Jan 09 '24 00:01 cwellsx

I was having the same problem with the following (pretty minimal) setup: https://github.com/elek-io/client/tree/660131a33bb07beb81b74b2d3bc61b901f3163cc

  • package.json name was @elek-io/client
  • Windows CI/CD (GitHub actions) is reporting: [FAILED] ENOENT: no such file or directory, open 'C:\Users\RUNNER~1\AppData\Local\Temp\si-202411-5832-djfyfc.osz8i\@elek_io\client.nuspec'

Workaround: Either modify package.json name to not include the org's name (e.g. client) or add a simpler name in the MakerSquirrel configuration (e.g. inside forge.config)

Nils-Kolvenbach avatar Feb 01 '24 19:02 Nils-Kolvenbach