chdir(): No such file or directory (errno 2) - laravel-4

I'm getting the above error when running composer install --working-dir=/path/to/directory
In case you're wondering: I had a hard drive failure so I needed to re-install composer and well... everything. After installing composer, navigating to the directory with the composer.json file and running composer install would result in an error that composer couldn't find a composer.json file, hence the --working-dir flag.
The project is a Laravel 4.2 project. We have everything in a git repo with the exception of the vendor folder. We figured we would just run composer install and all would be right in the world - and it was.
I ran composer install --verbose and received the following:
Exception trace:
() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:149
Composer\Util\ErrorHandler::handle() at n/a:n/a chdir() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:149
Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
require() at C:\ProgramData\ComposerSetup\bin\composer.phar:25
Any ideas would be appreciated. Not sure why I'm suddenly having these problems. A week or two ago a co-worker was able to run all of the same steps without error.

As it turns out, the main problem was the starting directory of gitbash.
When I installed it, I changed the starting directory to be c:\users\[me]\My Documents
Even though this directory had sub-directories, and I could cd into them; running an ls would produce 0 results.
I ended up changing the starting directory to c:\users\[me]\Documents and everything worked fine. Composer found the composer.json file and all other commands worked. Lesson learned.

Related

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.

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

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.

Laravel composer signal "11" error symfony osx

Anything I try to execute in Laravel, even minor files locally gives this message in composer:
[Symfony\Component\Process\Exception\RuntimeException]
The process has been signaled with signal "11".
Using OSX 10.7.5
Any help appreciated, as always.
For example :
composer update
typed in terminal retrieves the error message above
Make sure to check your composer cache folder has the right permissions for all files and folders.
If you ever ran composer as sudo or root then these cache folders could have the wrong root permissions.
Look at all the files and folders inside:
ll ~/.composer/cache/
Make sure you have proper permissions to write files in app/storage directory. And you can always use the following method of installation.
cd /your/app/directory
git clone https://github.com/laravel/laravel.git .
composer install
I got this error due to circular dependency on AppServiceProvider (when 2 services depend on each other). As the error does say much it took me a loooong time figure it out :/
Try:
Reinstall or upgrade PHP (Cli)
Make sure your .composer directory permission
This error message from laravel artisan is caused by Composer command error, you can try the same way from using command like:
composer dump-autoload -o
It should also cause error relating from aristan optimize command which be trigger from post-update-cmd" in composer.json.
In my case, the error is segment fault via Cygwin PHP so that I change to use XAMPP PHP to run it and it worked.
Try to run thin command
composer dump-autoload
I eventually solved this by employing a freelancer who was excellent and very knowledgeable.
First needed to update OSX with Maverick (free) - (I had to change my hard drive to do this!)
Then needed to download xcode
Composer should then function, you may need a new installation of laravel
Hope that helps someone!

Resources