I am trying to install the latest version of Laravel Homestead on my PC and when I try running the command homestead init in my command terminal, I keep getting a "Could not open input file" error.
Steps I've taken so far with installing Laravel Homestead:
1) Created a new directory at C:\Users\Jeff\Desktop\Code
2) Installed Composer
3) Installed VirtualBox and Vagrant Box
4) In 'cmd', ran the command vagrant box add laravel/homestead
5) Copied the Composer files from C:\ProgramData\ComposerSetup\bin into my C:\Users\Jeff\Desktop\Code directory.
6) In 'cmd', ran the command composer global require "laravel/homestead=~2.0"
Since I am following the Laravel homestead installation guide the next step is to copy the ~/.composer/vendor/bin directory to my PATH so that the homestead command is executable but this is where I get confused.
I have tried a couple of things but they have not worked for me.
In my ~/.composer/vendor/bin directory, I have copied the homestead directory files into my C:\Users\Jeff\Desktop\Code directory but when I try running the command homestead init, I keep getting the error Could not open input file: C:\Users\Jeff\Desktop\Code/../laravel/homestead/homestead
On Windows use homestead.bat init instead of homestead init.
Related
I try to create a clean project with Laravel and Homestead, so that if somebody download my project, only a vagrant up is necessary... look like a Paradox or maybe I do something wrong.
I create a new laravel project dir
I run composer require laravel/homestead --dev to install homestead.
I get requirements errors because the composer.json was already created from laravel, and it needs the requirements from the VM
I could do a composer install inside the homestead VM
But the homestead VM doen't exist already because I can't install homestead
To make homestead works but not the right workflow:
I did a composer require laravel/homestead --dev outside the laravel dir and I copied the homestead files inside the laravel project dir
vagrant up from the laravel dir
composer install in the VM (this remove all the homestead files because homestead isn't in the composer.json)
This looks wrong, which would be the right way to add homestead to a laravel project?
Ok I figure it out.
You can put the homestead folder and the laravel folder in the same project, like:
--project_folder
|--homestead
|--laravel
And change the path in Homestead.yml to the laravel dir
Then to take the project running:
do a compose install in homestead
vagrant up
in the VM compose install to prepare the laravel app
I have a freshly installed Laravel. I did a vagrant destroy --force before installation.
Every time I run anything using vagrant on my laravel project directory, I get this error.
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.
Path: /Applications/MAMP/htdocs/Sites/project-flyer/Vagrantfile
Line number: 12
Message: LoadError: cannot load such file -- /Applications/MAMP/htdocs/Sites/project-flyer/vendor/laravel/homestead/scripts/homestead.rb
exit 1
Now, I've checked, looking for homestead.rb but vendor/laravel/homestead folder doesn't exist. I'm lost.
It seems there is a broken homestead installation in your directory. You could do:
Deinstall the existing homestead with composer remove laravel/homestead
Reinstall homestead with composer require laravel/homestead --dev
Initizialie homestead and Vagrant configuration php vendor/bin/homestead make
For details you can also consult the homestead documentation.
While installing homestead following the official installation instructions of version 4.2, I received the following error message when executing $ homestead init:
i.e.
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "init" is not defined.
My step before that was to install homestead with composer global require "laravel/homestead=~3.0"
I installed Laravel Homestead version 3.0.1 and homestead is in my PATH.
Hmmm I remember having this problem when I was first installing homestead. I can see the link you provided is in relation to Laravel 4.2. Following the homestead installation from the 5.2 docs seemed to be fine for myself however:
Laravel Homestead: Installation & Setup
The solution is very simple.
Make sure you have added this to your bash profiel or .zshrc file.
function homestead() {
( cd ~/Homestead && vagrant $* )
}
I am trying to install the homestead vagrant box for developing purposes. I followed this guide, but when i use homestead init i get this error: 'homestead' is not recognized as an internal or external command, operable program or batch file. although i have ~/.composer/vendor/bin added to my PATH enviroment.
Does anyone know how i can solve this problem?
Try downgrading to Homestead 2.0.7 - there are currently some problems with Windows path to home folder.
Edit your composer.json file in %appdata%\Composer and change your laravel/homestead dependency to:
"laravel/homestead": "2.0.7"
Then run composer update on the file.
That worked for me!
See the bottom of this post: http://mikesinn.com/development/how-to-install-composer-in-windows/
add this location C:Users/m_000/AppData/Roaming/Composer/vendor/bin. into path window then run homestaed init
I am on a windows 8 machine and I'm trying to learn laravel. I copy and pasted my PHP folder from C:\xampp to C:\php, installed composer, ran composer install then composer create-project laravel/laravel learning-laravel. So far everything was created so I went into the directory and tried to use 'php artisan serve' and got the following error.
C:\Users\denni_000\learning-laravel>php artisan serve
Warning: require(C:\Users\denni_000\learning-laravel\bootstrap/../vendor/autoloa
d.php): failed to open stream: No such file or directory in C:\Users\denni_000\l
earning-laravel\bootstrap\autoload.php on line 17
Why you copied php folder
download composer install it.
download laravel latest version and store it on your xampp/htdocs/laravel
and run cmd with composer install command
For more follow install laravel on windows xampp
or Laravel 4.1 installation with composer in xampp
For windows Simply download Laragon which includes latest php 5.6.7, Apache, Mysql, Redis, Memcached an alternative to Xampp or Mamp with small size. Easy to install laravel and create project with auto create virtual host by it. Thank you.
U need to go to the directory where laravel is installed and run the following command.
composer update
Install Laravel 4.2 with composer:
sudo composer.phar create-project laravel/laravel project-directory-name 4.2 --prefer-dist
Here is a different way to setup laravel, may be you guys will like it
Step 1:
Clone https://github.com/laravel/laravel or you may download zip also.
Step 2:
Navigate to downloaded folder in command prompt and run composer install
Step 3:
open the folder and rename .env.example to .env and update the credentials mentioned in file.
Step 4:
After these steps if you navigate to the directory from web-server it will cause an error No supported encrypter found. The cipher and / or key length are invalid. to fix this just run php artisan key:generate
Done!
Hope you guys like this way :)
You need to install all the laravel required dependency.
To do that, you need to tell composer to install everything needed.
Below is the command to use to install that's required in laravel composer.json.
composer install
Follow the installation guide from Laravel
Install Composer:
Like Laravel.com says: "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system."
Type the following statement in the command line:
composer global require "laravel/installer=~1.1"
Create a fresh Laravel project in a specified directory with the "laravel new" command:
laravel new blog
You can also create a Laravel project using composer, like such:
composer create-project laravel/laravel --prefer-dist
If you want to learn laravel I seriously recommend you use laravel homestead with vagrant.
For this you need to:
Install virtualbox.
Install vagrant.
Install git.
Install ssh.exe (Download msysgit and copy the content of bin folder to git bin folder).
Install Homestead on Vagrant (Follow the steps on laravel/homestead documentation page).
Install Laravel on Homestead (Follow the steps on laravel/installation documentation page).
This method apply to Windows, Linux or Mac, only change the step 4 on linux or mac.