I ran following 3 sets of command in order to install laravel via command prompt :
1) composer
2) cd D:\xampp\htdocs\Laravel
3) composer create-project --prefer-dist laravel/laravel Laravel
It said that the download was successful , but when i opened the laravel folder , it is empty. So, i tried reinstalling it but it showed as below :
[InvalidArgumentException]
Project directory Laravel/ is not empty.
Any help on this ?
You should run:
composer dump-autoload
and if does not work you should:
re-install composer
and
composer create-project --prefer-dist laravel/laravel blog "5.8.*"
You should let composer installer create the folder for you.
Hence your updated list of commands would be:
CMD
cd D:\xampp\htdocs\
composer create-project --prefer-dist laravel/laravel demo_project
demo_project is the name of the folder/project name that would be created inside htdocs
Related
I want to install Laravel 6 with Composer. I try with that command:
composer create-project --prefer-dist laravel/laravel laravel6 "6.*"
But i get that result:
[InvalidArgumentException]
Could not find package laravel/laravel with version 6.*.
Here is a screenshot
If i use:
composer create-project --prefer-dist laravel/laravel blog
It install the v5.5.28
Here is a screenshot
What can be the problem?
Which PHP version you are using? Laravel-6.* need PHP >= 7.2.0. Check your server-requirements for Laravel 6.*. May be you did not meeting the requirements for laravel 6.*. And after meeting the requirements run your command inside htdocs folder for xampp or www folder for wamp webserver.
your command are no longer supports so you should use:
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
You forgot to add the "--prefer-dist " . So in your case, you have to use the:
composer create-project laravel/laravel --prefer-dist
in order to make it work. So just remove all the files from: d:\xampp\htdocs\laravel and then try again by following the below commands to your cmd (I guess you are using Windows!):
cd d:\xampp\htdocs\laravel
composer create-project laravel/laravel --prefer-dist
I think this should work for you just fine
You don't need to specify the version of Laravel 6. By default, Laravel 6 installs the latest version and its extension.
As I'm writing now the current and latest version of Laravel is: Laravel 6.0.4
The command below will install the current and the latest version in your laravel6 project.
composer create-project --prefer-dist laravel/laravel laravel6
You don't need to specify the version of Laravel 6. By default, Laravel 6 installs the latest version and its extension.
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel your_project_name
I think it will be helpful for you. for more details visit laravel official website : https://laravel.com/docs/6.x/installation
Please check the permissions on the cache dir (/home/keynes/.composer/cache)
It's complaining it cannot write to this dir, or it may not exist.
Maybe it is installing an older laravel version from the cache dir.
Kindly upgrade your PHP version on your system.
Then install laravel commands
It will automatically install the lettest version depends on the PHP version.
Or you can mention on laravel command and set the laravel version like "6.0*" behind the laravel installer command.
I hope this will works 😊
The commands you are running should work. I would try clearing the composer cache:
composer clear-cache
and then
composer update
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
before trying again. Looking at the screenshots there seem to be some permissions errors in the ~/.composer directory. This might also cause the composer clear-cache command to fail with an error.
So if clearing the cache doesn't work or you get an error, you might try moving the ~/.composer directory to a backup location, to force composer to regenerate it's settings.
mv ~/.composer ~/.composer.backup
And then try it again (be aware that composer update will likely take a noticeably longer time than usual and might be unresponsive for a while):
composer update
composer create-project --prefer-dist laravel/laravel="6.*" laravel6
If it still doesn't work, then you can restore the backup:
rm -rf ~/.composer
mv ~/.composer.backup ~/.composer
Then looking at the output of
composer config --list --global
might help determine the next thing to try.
After familiar with Codeigniter, I stared to learn Laravel.
I able to install Laravel using following command.
composer create-project --prefer-dist laravel/laravel blog
It works fine. :-)
Next I tried to setup sample Laravel project. I found a sample project from here (https://github.com/evercode1/sample-project).
What I did is I just download it and copied all folders to Xampp htdocs folder.
Then I visit the "http://localhost/sample-project-master/public/".
It gives following error.
Warning:
require(D:\xampp\htdocs\sample-project-master\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
D:\xampp\htdocs\sample-project-master\bootstrap\autoload.php on line
17
Fatal error: require(): Failed opening required
'D:\xampp\htdocs\sample-project-master\bootstrap/../vendor/autoload.php'
(include_path='D:\xampp\php\PEAR') in
D:\xampp\htdocs\sample-project-master\bootstrap\autoload.php on line
17
Have I done mistake when setting up already available Laravel project? How I correct following errors or what is the way to import Laravel project?
You should do:
1) Install composer dependencies
composer install
2) An application key need to be generated with the command
php artisan key:generate
3) Open Project in a Code Editor, rename .env.example to .env and modify DB name, username, password to your environment.
4) Migrate the database along with seed
php artisan migrate --seed
5) Now run the artisan serve command
php artisan serve
the first error is due to not getting file path for bootstrap in bootstrap folder .
you should run: composer install
3 . laravel requires vendor libraries which needs to be install , it does not come automatic with the package . because it's is git ignored . so you need to install it if needed.
You should try this
composer install
OR
composer update --no-scripts
composer update
For more details please follow this link.
This means some dependencies are messing,
Open your project root folder and run this command:
composer install
or
php composer.phar install
I believe below command should work as I have tested on Windows and Linux:
composer update --no-scripts
or if you already installed and updated the composer then check below command:
composer global update
first You have to move the project to www(folder) or htdocs if using xamp or any folder that apache load the files from
then open ur terminal or cmd , and cd untill u reach prject folder , or u can do
shift + right click in the folder , a menu will come up choose "open command window here" .
then write this command composer update this will install all the packages u need to run the project .
dont forget to modify .env file with your database information .
this should work .
You are facing this issue because your system might not have composer.laravel need dependency manager.you have to install the first composer to your htdoc folder.
You can install composer using following this command,composer installNow you can install laravel using (must run this command inside your htdoc)composer global require "laravel/installer"
Now you can create project usinglaravel new YOUR_PROJECT_NAME
OR
composer create-project --prefer-dist laravel/laravel YOUR_PROJECT_NAME
Note : it is good if you install composer and laravel on global location.
Documentation Available Here : https://laravel.com/docs/5.4/installation
My composer.phar file is under xampp/php folder. When I download cakephp through composer (by using command : php composer.phar create-project --prefer-dist cakephp/app myProject), it downloads the project folder (i.e. myProject folder) under : xampp/php/myProject. Although it should download the project under htdocs folder.
How to download a project through composer under htdocs folder?
Just indicate complete path to your project:
php composer.phar create-project --prefer-dist cakephp/app /path-to-htdocs/myProject
(disclaimer: I just tried with a global composer instalation, not throught a .phar, but it should work too)
Steps I've done:
I created a folder named 'laravel_5'.
open 'cmd' then typed 'cd D:\xampp\htdocs\laravel_5'.
re-enter 'D:' to change directory.
now I'm in the directory 'D:\xampp\htdocs\laravel_5'.
I input the command 'composer create-project laravel/laravel --prefer-dist' found in the laravel website.
Error occurred:
When you create new project using composer, it will automatically create project folder for you.
Go to D:\xampp\htdocs and change your composer command to this:
composer create-project laravel/laravel laravel_5 --prefer-dist
Or
If you still facing problem while using composer to create laravel project then simply go to github and clone the repo or download the zip and do composer update within your application directory.
https://github.com/laravel/laravel.git
I don't get how the create-project works in composer. Lets take Laravel as example.
I can install this PHP framework with the following command:
composer create-project laravel/laravel --prefer-dist
This command installs the framework for me leaving me with a few folder in the root of my dir:
app
bootstrap
public
vendor
Plus some files.
But when I simply use the following composer command:
composer require laravel/laravel --prefer-dist
composer install
Then this only installs the vendor folder. No other files and folders are downloaded by composer.
How come? What is so different? How does composer know what other files to get when I use the create-project laravel/laravel command and why do I only get the vendor folder when I do require laravel/laravel?
require will add a dependency to the composer.json file and load it into the vendor directory as you have correctly noticed.
create-project on the other hand will clone the dependency, i.e. use the dependency as a template for a new project. Take a look at the repository behind laravel/laravel: https://github.com/laravel/laravel