Skip to content
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

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

Open
funnyoldgames opened this issue Aug 8, 2024 · 6 comments · May be fixed by NativePHP/electron#106
Labels
bug Something isn't working

Comments

@funnyoldgames
Copy link

funnyoldgames 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

@funnyoldgames funnyoldgames 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?

@funnyoldgames
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 simonhamp linked a pull request Sep 7, 2024 that will close this issue
@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.

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.

5 participants