Search code examples
phplaravelvagranthomestead

The provided cwd "/home/www/myproject" does not exist


I used to map only one folder to my projects root folder as recommended in Laravel 5.6.

Now, I mapped each folder to each separate project as recommended in Laravel 6.x.

Now if I login into my VS with vagrant ssh and try laravel new myproject I get

The provided cwd "/home/www/myproject" does not exist

If I create the folder beforehand, than I get

Application already exists

If I install as root, then Laravel gets installed, but I can't find my project on my PC. I see it on my VS, buts it not on my hard-drive.

This is the config in my Homestead.yaml:

- map: ~/www/homestead/myproject # Path on my laptop
  to: /home/www/myproject #Path of VM

I find /home/www/myproject which I created on my VS, but ~/www/homestead/myproject does not exist on my PC.

I did not have these issues when I was only mapping one folder. How can I fix this and create a new Laravel project?


Solution

  • I solved this by installing Laravel command globally with composer on my PC. To do so, I had to install zip first:

    sudo apt-get install php7.2-zip
    

    Then I could install it globally

    composer global require laravel/installer
    

    Which displayed

    Changed current directory to /home/adam/.config/composer

    and I had to add this to my ~/.profile:

    PATH="$HOME/.config/composer/vendor/bin:$PATH"
    

    I reloaded profile in command with source ~/.profile and then I finally could install Laravel from my PC instead from the VM.