简体   繁体   中英

Laravel Homestead Installation: bash init.sh not working

I'm trying to install Laravel Homestead in order to be able to test my Laravel projects locally.

I'm following this tutorial: http://laravel.com/docs/4.2/homestead

In the "Installing Homestead" part I followed the second step "Manually Via Git (No Local PHP)",I don't have any PHP installed locally and can't use Composer. (Wasn't PHP supposed to be installed as part of Homestead?)

I got to this part:

Once you have installed the Homestead CLI tool, run the bash init.sh command to create the Homestead.yaml configuration file:

bash init.sh

In command prompt I tried to enter the following command:

bash init.sh

I got the following error:

'bash' is not recognized as an internal or external command, operable program or batch file.

Then I tried to enter the same command in Git Bash, and I got the following error:

bash: init.sh: No such file or directory

When I tried to enter in Git Bash simply

init.sh

I got the following error:

sh.exe": init.sh: command not found

I ran into this problem well. You need to hop into your terminal (I am on Mac.)

  • Type into your console: cd ~/Homestead
  • and to make sure you are in your newly generated Homestead folder (you can always click Finder > your home directory > Homestead to confirm it's where it should be),
  • then while in terminal simply type ls -- if it lists all of the files like Vagrantfile , composer.lock and bash init.sh , you should be in.

Once you know you are in the correct Homestead folder, it is now at that point in which you run bash init.sh

After doing this it now says Homestead initialized!

.sh is a unix/linux script executable , that isn't recognized on Windows . There's a init.bat included in the package, but it isn't referenced in the tutorial.

Just run init.bat from the command line. It will copy the files to:

%HOMEDRIVE%%HOMEPATH%\.homestead

您需要安装 Git Bash,然后在 Git Bash 中运行命令。

尝试对我init.bat

I found the answer you may be looking for. I was having the same problems with this. Just make sure at the end of bash init.sh you put a ;

So in the git bash cmd you will have this line

$ bash init.sh;

只需使用 sudo 即可。

$sudo bash init.sh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM