Using Laravel "Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such - laravel

I am new to laravel, composer, and windows terminal. I am trying to setup laravel on my local host. I currently have wamp installed and I have used it before to create basic websites. However, I am now doing a bigger project that needs a framework so I decided to learn Laravel. I installed composer as indicated in the directions, but when i run the command
"C:\wamp\www>composer create-project laravel/laravel laravel"
i generate an error message that says
"[InvalidArgumentException] Project directory laravel/ is not empty."
When I open a browser and navigate to "localhost/laravel/public" I encounter the error message from the title of this thread:
"Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
I have also added the appropriate environment variables from the composer instructions.
I am really lost at this point, and I have spent the past 4 hours trying to debug this.
I am running Windows 8 x64.
Edit:
I tried running composer install in C:\wamp\www and received an error message
Composer could not find the config file:
C:\ProgramData]ComposerSetup\bin Ti initialize a project, please
create a composer.json file as described in the
http://getcomposer.org/ "Getting Started" section "

The dependencies for your project are not installed. Just download composer from GetComposer.org and install it on your Windows Machine. Then navigate to your project root, you will see a composer.json file there. That file specifies all the dependencies of the project. Run composer update in that directory. Composer will then update or install all required dependencies and your application won't show the error then.
cd \wamp\www\yourproject
composer update

"C:\wamp\www>composer create-project laravel/laravel laravel"
"[InvalidArgumentException] Project directory laravel/ is not empty."
This means C:\wamp\www\laravel already existed when you attempted to run the command. Remove the folder, or change the create-project command to use a different folder name for your new project.
"Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
You need to do a composer install from C:\wamp\www\laravel.

I figured it out! I was missing a folder called "vendor" and a file inside bootstrap called "compiled.php" Sorry for the inconvenience, and thank you for trying!

use the following command to get vendor folder in your project
composer install --no-scripts

i had the same problem but i just ran this command
composer install
to install all the dependencies

Related

How to install composer globally for laravel app in windows?

I have a question related to composer and laravel. My question is whenever I install the fresh laravel app using command :
composer create-project laravel/laravel blog
Inside my C://xampp/htdocs/ directory and then change path to C://xampp/htdocs/blog/, here I am unable to run the composer command but I had already installed composer from its official website globally in C://xampp/htdocs/ directory. So is there any way to use composer command globally whenever I install fresh laravel app, so that I don't want to install composer in the laravel app directory everytime.
Now I guess they provide direct setting up global installation,
Check here
I did it like this a lot earlier,
Change to the path (or you can add that directory to your path later), and run the installer as mentioned on composer download site to download composer.phar.
Create a new composer.bat file alongside composer.phar.
Using cmd.exe:
run
echo #php "%~dp0composer.phar" %*>composer.bat
Then set it to path environment variable(see this)
Test with a new terminal:
composer -V
Will return
Composer version 1.10.6 2020-05-06 10:28:10
go to composer website and download the exe file, you should have it gloablly if you install it that way.
Good luck ^_^

how to fix error laravel 5.2 "failed to open stream: No such file or directory" without composer

I've got this error in my laravel 5.2 project who hosted in debian linux
Warning: require_once(/home/u706561288/public_html/sap/vendor/composer/autoload_real.php): failed to open stream: No such file or directory in
/home/u706561288/public_html/sap/vendor/autoload.php on line 5
Fatal error: require_once(): Failed opening required '/home/u706561288/public_html/sap/vendor/composer/autoload_real.php' (include_path='.:/opt/alt/php70/usr/share/pear') in
/home/u706561288/public_html/sap/vendor/autoload.php on line 5
so many forum like stackoverflow tell me to using php artisan "composer update" but
unfortunately my hosting package not available to composer instalation
please tell me how to fix this problem
I suggest that you test these steps
On the Localhost, run these two commands (composer update and composer dump-autoload)
Re-upload the entire project on the server
Also, if the problem is not resolved, you can delete the ‍Vendor folder and the composer.lock file and run the composer install command and Re-upload the entire project again.
When the hosting service or some PC does not allow to install Composer and appears error like in my case, follow these steps:
Delete all laravel project in hosting service. I recommend to use smartftp for good speed file access and tracked action.
Back to our localhost project and run composer install --no-scripts command and then composer clearcache.
Reupload all laravel project.
Don't forget to configure .env file.
I hope this can help with the same problem in future.
I had the same error while back, what I did to solve it was. I delete all the vendor folder from the root project then install it back by executing composer install
delete the ‍Vendor folder and the composer.lock file and run the composer install command and Re-upload the entire project again
this helped me
If anyone still facing the issue after deleting the vendor directory and did composer install try to update your composer by composer selfupdate then do the same install process.

Can't create projects with Composer on Windows 7

I'm trying to install Laravel with composer on Windows 7 and am running into an error. This is the command I'm running:
composer global require "laravel/installer=~1.1"
This is the error I get:
file_put_contents(C:\Users\myUser\AppData\Roaming\Composer/vendor/composer/installed.json): failed to open stream: No such file or directory
It's correct to say that the installed.json file does not exist, there's not even a composer folder inside the vendor folder. Not sure why that would be missing. I installed composer using the Windows installer.
Seems to be a composer related issue rather than laravel. I just tried installing yii and am getting a similar error running this:
composer create-project --prefer-dist yiisoft/yii2-app-basic MyApp
For this one, I get this after it successfully creates the folder and seems to load most files:
file_put_contents(C:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
Seems like the problem is that I never have a composer folder in my vendor folder.
UPDATE
I was able to get laravel to install globally by adding the COMPOSER_HOME environment variable. But I still run into a similar error when setting up a Laravel project after that
UPDATE 2
Some additional info, when I use the Windows Installer, composer gets installed in c:\ProgramData\ComposerSetup\bin. If I set the COMPOSER_HOME environment variable to this, laravel can get installed globally. But trying to install a project using the "laravel new MyApp" throws the following error:
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wwwroot\MyApp\artisan on line 31
I suspect that's because I have PHP 5.4 and the latest version of laravel is 5.6 and above, but I want to install 5.0, which is 5.4 and above. I tried doing it using "composer create-project laravel/laravel MyApp 5.0 --prefer-dist" instead. I get the following error:
file_put_contents(c:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
Seems there's just something weird going on with paths that I can't quite figure out.
UPDATE 3
I've now uninstalled composer and re-installed it manually per the instructions provided on the composer site. I'm now trying to create a project using the following command from c:\wwwroot:
composer create-project laravel/laravel c:\wwwroot\MyApp --prefer-dist
It does manage to install some stuff, but seems I get this error before any package it tries to install:
Installing laravel/laravel (v5.1.4)
Loading from cache
Failed to download laravel/laravel from dist: RecursiveDirectoryIterator::__construct(C:\wwwroot/vendor/composer/,C:\wwwroot/vendor/composer/): The system cannot find the path specified. (code: 3)
Again, seems like it can't create a directory for vendor/composer for some reason. I tried running the same command, but from inside an empty c:\wwroot\MyApp folder, same result except the path in the error changes accordingly.
I found the following: https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows-
But I checked my registry and I have none of these entries. So still no clue.
It seems that your composer is not globally accessible. Try to add C:\Users{UserName}\AppData\Roaming\Composer\vendor\bin to your environment variable then restart your Shell or Command-Prompt so that updated Path variables is loaded. Now try to install laravel again.
Here is the detailed instruction:
Go to Control Panel > Systems ans Security > System > Advanced system settings then navigate to envirinment variables then scroll down and locate the PATH then add a semi colon (;) at the end of the PATH string. This means you are declaring a new variable. Then paste the C:\Users{UserName}\AppData\Roaming\Composer\vendor\bin after (;) you have added, restart the command prompt and try to install laravel again.
Uninstall composer and install it again, but this time do enable shell menu. Right click on the location (directory) where you want to create the project, select "use composer here", then "composer create-project laravel/laravel projectName --prefer-dist" should create your laravel project, default to latest version (5.1).
To specify your prefer version:
"composer create-project laravel/laravel 4.2 projectName --prefer-dist"
I will suggest you to install Homestead (http://blog.teamtreehouse.com/laravel-homestead-on-windows) and do all the heavylifting there.
You just need to do homestead ssh to actually connect to your machine and then perform all your operations.
Windows is pretty unpredictable in that kind of situations and in web development in general.

Composer how to specify install directory

Hi I've recently downloaded Laravel as a PHP framework, I've installed composer and have got that working, I've got it to create my project as per the Laravel website
composer create-project laravel/laravel --prefer-dist
However when I use the above line this installs my project in the c:\users\guti directory however I want it to be installed in c:\xampp\htdocs.
I've seen another question on stackoverflow and it talks about amending the composer.json file but I'm not sure whether this is the route I should be taking as I've done a computer search for this file and this file exists as part of the laravel framework so does it make sense to amend this file?
Any composer experts on hand to point me in the right direction?
composer create-project laravel/laravel .
Installs in your current directory =)
You should specify your destination directory where you want to create the project, from the command prompt, type cd C:\xampp\htdocs then press enter. After that, type following code on the command prompt and press enter
composer create-project laravel/laravel my-laravel-project
Here my-laravel-project will be your project folder.
The composer.json file is used to setup some configurations (for Dependency management) during installation of the package via packagist.
Visit getcomposer.org for more information.
Whenever
composer create-project laravel/laravel .
Doesn't work properly for whatever reason, I just
laravel new temp
And then move the contents of the new application into the folder I do want ; )
I needed to do this myself. In the directory I wanted it installed, I did:
laravel new --force .
And it seems to be working well so far.
This works for me on Ubuntu 20.04, Composer version 2.1.6:
cd your-directory
composer create-project laravel/laravel ./
TL;DR
composer create-project --prefer-dist laravel/laravel directory-name
Move files to preferred folder if needed (e.g. to ../)
Why don't laravel new /.?
laravel new project-name not always works good on different systems, so you need to edit PATH variable multiple times to add laravel command to cli (at least on OSX it's not that easy as on Ubuntu).
composer create-project --prefer-dist . may not work because of not empty directory (e.g. in JetBrains IDE's, which creates folder .idea/ which doesn't shows in IDE's 'project' view, only on 'project files'). Exception message looks like
[InvalidArgumentException]
Project directory ./ is not empty.
So, if you know what you doing, do as you wish, on the other way, especially if you want as few problems as possible, do the steps from the top lines of this answer.
P.S. I'm speaking english not as good as i want to do, so, anyone, feel free to correct me.

Laravel 4 Installation Problems on WAMP/Windows

First,I use wamp on my Window7.I open php-openssl,and I git pull the laravel from github.com,and then I put laravel on my d:/wamp/www/, I change the c:/windows/system32.But when I open the url
http://localhost/laravel/public
I see this question.
I am a newbie on laravel,and without install on Ubuntu.Where is my wrong, without no pear,or something else? Thank you!
You need to run composer install in a command prompt.
If you do not have composer, download the phar file from their website.
Place the file you just downloaded into the laravel directory.
Then, make sure that the absolute path to php.exe is added to your PATH environment variable.
Then, you can hold down shift, and right click anywhere inside the laravel directory, and open up a command prompt window. Then, run php composer.phar install. The process may take some time, depending on the speed of your internet connection.
Instead of using the above method, you can download the Composer installer for Windows, install it, and just run composer install.
Note that you only need to do this in order to put the Laravel components together. You do not need to run it on a live server.
Please consult the Laravel Docs for installation and other instructions: http://laravel.com/docs
Try This :
Installing Laravel 4 on WAMP
1. Enable OpenSSL
OpenSSL must be enabled in the PHP configuration.
Edit php.ini in your WAMP’s PHP folder, e.g.:
C:\wamp\bin\php\php5.4.12\
Note: This is not the php.ini in C:\wamp\bin\apache\Apache2.4.4\bin.
Find the following line and remove the semicolon save it:
;extension=php_openssl.dll changed to extension=php_openssl.dll
2. Install Composer
(i).Download the Composer Windows installer from getcomposer.org.
(ii). Run the installer.
(iii). When it asks for the location of php.exe, point it to the executable in your WAMP’s PHP folder, e.g.:
C:\wamp\bin\php\php5.4.12\
(iv). Finish the installation.
(v). Open a command-line interface (cmd) and type:
composer
It should return a list of options. If you get an error, restart your computer and try again.
Composer has now been installed and added to your PATH environment variable. This means you can run it from any directory using the command-line interface.
Now we need to install Composer. This is a dependency manager that will download the latest release of Laravel and specific versions of Laravel’s dependencies, such as Doctrine and Symfony.
3.Install Laravel
Now that Composer has been installed, Composer can download and install Laravel onto your system.
(i). Open a command-line interface (cmd).
(ii). Go to the directory in which you want to install Laravel. This is usually your development directory. In this tutorial, we’ll use C:\wamp\www\laravel
(iii). Instruct Composer to install Laravel into a project directory. we use project name myproject.
composer create-project laravel/laravel myproject --prefer-dist
Note: This will install Laravel in a subdirectory myproject of the current working directory.
Three type of installation to be completed
Now your project was running directory like
C:\wamp\www\laravel\myproject\public\
After completed put tick mark and increase the point....
Do php composer.phar dump-autoload or php artisan dump-autoload

Resources