Skip to content

Building app fails when there are spaces in the APP_NAME field of the .env file #343

Closed
@peskybogle

Description

@peskybogle

What were you trying to do?

Trying to build my app on an Apple Silicon Mac, targeting Apple Silicon Macs

What happened?

When there are spaces in the APP_NAME field in the .env file, the build fails. Error message:

electron-builder version=24.13.3 os=23.0.0
Invalid name: "Example Name 2025" failedTask=build stackTrace=Error: Invalid name: "Example Name 2025"

How to reproduce the bug

  1. try to build after a fresh install, it works
  2. run php artisan native:serve
  3. app names with spaces from the .env are copied to the 2 package json files
  4. try to build, fails with above message
  5. remove the spaces from the app name in the 2 package json files, but not the .env file
  6. try to build again, it works

Note:
Simon said on Discord:
3) is expected because we intentionally rewrite the app name in the package.json when we run native:serve as a way to show the correct app name in debug builds (which Electron doesn't support by default)
so the problem looks like electron-builder doesn't like the spaces in the name
i'll take a look at this later

Package Versions

{
    "installed": [
        {
            "name": "nativephp/electron",
            "direct-dependency": true,
            "homepage": "https://github.com/nativephp/electron",
            "source": "https://github.com/NativePHP/electron/tree/0.6.5",
            "version": "0.6.5",
            "description": "Electron wrapper for the NativePHP framework.",
            "abandoned": false
        },
        {
            "name": "nativephp/laravel",
            "direct-dependency": false,
            "homepage": "https://github.com/nativephp/laravel",
            "source": "https://github.com/NativePHP/laravel/tree/0.5.3",
            "version": "0.5.3",
            "description": "Laravel wrapper for the NativePHP framework.",
            "abandoned": false
        },
        {
            "name": "nativephp/php-bin",
            "direct-dependency": false,
            "homepage": "https://nativephp.com",
            "source": "https://github.com/NativePHP/php-bin/tree/0.4.0",
            "version": "0.4.0",
            "description": "PHP binaries used by the NativePHP framework",
            "abandoned": false
        }
    ]
}

PHP Version

8.3

Laravel Version

11.19.0

Node Version

22.5.1

Which operating systems have you seen this occur on?

macOS

OS version

14.0

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions