Skip to content

Using https://laravel.build does not work if the current path contains spaces #39182

@NiclasvanEyk

Description

@NiclasvanEyk
  • Laravel Version: 8.64.0
  • PHP Version: 8.0.0
  • Database Driver & Version:

Description:

Since https://laravel.build is not open source (at least I did not find it), I am reporting it here instead.

The recommended way of creating a new Laravel application using

curl -s "https://laravel.build/example-app" | bash

does not work the path to the current directory contains spaces, due to an unquoted string in the returned shell script.

Steps To Reproduce:

Go to a folder containing spaces

mkdir "$HOME/I contain Spaces" && cd "$HOME/I contain Spaces"

Try to create a new Laravel app using the recommended approach

curl -s "https://laravel.build/example-app" | bash

This leads to

Unable to find image 'contain:latest' locally
docker: Error response from daemon: pull access denied for contain, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
bash: line 16: cd: example-app: No such file or directory

Solution

Current output: https://laravel.build/example-app
When binding the current directory to /opt inside the container, the output of $(pwd) is not quoted. This is why spaces can lead to the command being invalid and the above error.

Solution:

# ...

docker run --rm \
    -v "$(pwd)":/opt \      # <-- The $(pwd) is now quoted
    -w /opt \
    laravelsail/php80-composer:latest \
    bash -c "laravel new example-app && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailhog,selenium"

# ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions