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

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.

Related

how to make php artisan command available?

I read previous posts here about same problem but they did not solve my problem. I am running wamp latest version on windows 7 and I cloned a laravel app from github then I ran composer install on the root folder of the app and all vendors installed. however I still can not execute php artisan list on the app root folder
I tried also this command
composer global require "laravel/installer=~1.1"
but same problem also there is no laravel folder installed inside vendor folder. I dont know what laravel version used with this web app
So how I can make php artisan work ?
Update:
I opened composer.json file and I found no Laravel frame work to install !! should I return to the developer who made this or I just add Laravel package to composer.json and run composer install again ? if so what I should add to the composer.json ? I dont know which version to install !!
Your project has to have an artisan file in the root directory, otherwise the php artisan command won't work.
I had a similar issue. Fixed it by using the following command, which results in a clean installation.
composer create-project --prefer-dist laravel/laravel my-project
If errors occur, your CLI will show them.
Docs

Laravel Composer Update Error - Permission Denied

I'm having error during updating composer. It's a Laravel 4 project which I've downloaded from .... and first time I updated it, it was fine and got updated. but due some reason I deleted that replace it with a fresh copy of that project, but now when I started to update it, it gives me the following error:
[ErrorException]
copy(/home/username/.composer/cache/files/symfony/security-core/3a27d7b34ee6
2cb0fdf5ad970e7777912ef4722f.zip): failed to open stream: Permission denied
In between first and second update of this composer I did the following:
Tried to installed Vagrant and homestead, but failed due to some internet connection problem.
Updated Composer failed
Uninstalled vagrant and reinstall composer.
Reinstalled Composer
Updated composer (success)
Tried to install vagrant and homestead (success)
Update composer (failed)
uninstalled vagrant
Reinstalled Composer
Update Composer (failed)
The above mentioned error is getting occured again and again. I also tried 'composer clearcache' but doesn't worked. One thing which I noticed that it's been 16-19 months I'm using composer and never heard of such errors, but since I tried to install vagrant it created hurdles and errors for me.
I'm using Ubuntu 15.04
Updating Laravel 4.0 project
Updating Laravel 5
both project got updated before installing vagrant and homestead, but not now.
/var/www is under the group of 'www-data' and 'username' also the part of this group.
Any help plz!!!!!!!!!!!!!!!
I found the solution. If you see the error then it would be clear that I don't had access to the:
"/home/username/.composer/cache/files/symfony/security-core/3a27d7b34ee62cb0fdf5ad970e7777912ef4722f.zip".
When I explore this directory, I found that its owner is 'root' or 'sudo'.
So I deleted the '.composer' directory and then started to update in my laravel project directory, every thing was fine and perfect! No problem at all!
sudo composer update
worked for me. it's a permission issue.
if it doesn't work then you can try to
delete '.composer' directory and composer update afterward.
I know its an old topic, but for mac users this might be useful, since commands in macOS are a little bit different from linux distros and I had a hard time figuring this out.
cd into ~ directory
sudo chmod -R 777 .composer
Done. Now you can install/update composer.
I had the same issue with a mac, Composer warn me about running commands with super user permissions, so I've just changed the owner of files directory in the repo /Users/MyUserName/.composer/cache like so:
sudo chown -R MyUserName files/
Hope this helps.
I just run sudo before an all when ok
sudo composer create-project laravel/laravel=5.3 /Users/peter/Sites/blog --prefer-dist

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.

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

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

laravel application moved to another pc

I have just transferred my laravel application to another pc and I have installed composer. I am running composer install at the root of the project but it shows the following error:
{"error":{"type":"ErrorException","message":"file_put_contents(\/meta\/services.
json): failed to open stream: No such file or directory","file":"C:\\national-fl
eet\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php","l
ine":71}}
I tried CACLS -R 755 app/storage (as admin)
and then composer update but the same error. bootstrap/compiled.php doesn't exists in my project. What should I do?
I got this error, because some folders in /app/storage were missing
To fix the error, I manually created the following folders:
app/storage/
app/storage/cache/
app/storage/logs/
app/storage/meta/
app/storage/sessions/
app/storage/views/
then delete the contents of my vendor folder and run composer update again
Try to remove the services.json in /meta (or rename it to something else) and try composer install again (or composer update). It is possible that the file hasn't got the correct rights for Laravel to write to.

Resources