electron / electron/forge

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

Open
#3,462 3 comments 3 reactions 0 assignees View on GitHub
bug maker/squirrel platform/windows
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) 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:
- [Make / Package should work with scoped package names #1745](https://github.com/electron/forge/issues/1745)
- [This comment](https://github.com/electron/forge/issues/1745#issuecomment-1767400163) implies that they too still have 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.