Skip to content

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

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

Closed
peskybogle opened this issue Aug 8, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@peskybogle
Copy link

peskybogle commented Aug 8, 2024

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

@peskybogle peskybogle added the bug Something isn't working label Aug 8, 2024
@Louxsdon
Copy link

I'm facing the same isssue here.
Were you able to resolve yours?

@peskybogle
Copy link
Author

I'm facing the same isssue here. Were you able to resolve yours?

For now I’m just removing the spaces from the 2 package json files before building the app. It still takes the name from the .env file for the actual build (which can still have spaces in it), so it’s more of a pain than a real problem.

@Louxsdon
Copy link

I'm facing the same isssue here. Were you able to resolve yours?

For now I’m just removing the spaces from the 2 package json files before building the app. It still takes the name from the .env file for the actual build (which can still have spaces in it), so it’s more of a pain than a real problem.

Okay, I'm also doing the same before I was able to build.

@avazquez-bit
Copy link

Are you using double quotes???

I have spaces in my app name value with double quotes and work fine, here is my example

APP_NAME="Samva Tracking"

@simonhamp
Copy link
Member

I've managed to reproduce this. A fix is coming in NativePHP/electron#106

@devpartap
Copy link

i have the same issue using ionic capacitor. removing the space does fixes it.

@gwleuverink
Copy link
Contributor

Also fixed in NativePHP/electron#153 in case that get's merged before the obfuscation branch.

@gwleuverink
Copy link
Contributor

Hey all 👋 this has been fixed. Please update your project to the latest beta.

@mhomeister
Copy link

mhomeister commented Apr 23, 2025

Hey there, i have the same issue, this is not fixed in 1.0.0 right? I dont know how old your "beta" is :)

nativephp/electron                 0.9.0   Electron wrapper for the NativePHP framework.
nativephp/laravel                  1.0.0   Laravel wrapper for the NativePHP framework.
nativephp/php-bin                  0.5.6   PHP binaries used by the NativePHP framework

Gives me this

  • electron-builder  version=24.13.3 os=24.5.0
  ⨯ Invalid name: "Budis Alphas"  failedTask=build stackTrace=Error: Invalid name: "Budis Alphas"

After some fiddling:

When updating the composer.json to use the current beta.4 with

    "require": {
        "nativephp/electron": "^1.0.0-beta.4"
    },

composer show gives me these version, which fixes the issue :)

nativephp/electron                  1.0.0   Electron wrapper for the NativePHP framework.
nativephp/laravel                   1.0.0   Laravel wrapper for the NativePHP framework.
nativephp/php-bin                   1.0.1   PHP binaries used by the NativePHP framework

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants