Vendor folder does not exist and cannot be created - windows

Question:
What kind of permissions should I give to Composer on Windows?
Server information:
Windows 2012 R2
IIS 8.5
Error message:
[RuntimeException]
C:\inetpub\wwwroot/vendor does not exist and could not be created.
Steps that I've tried and thoughts:
I've installed Composer through the .exe file.
I have a composer.json file in C:\inetpub\wwwroot and when I try running composer install or composer update, I get the error message.
I've tried manually creating the vendor folder in the directory, but then it cannot download the package that I have in my composer.json file, giving roughly the same error message, that the package doesn't exist and could not be created.
I've googled the error, and I'm led to believe it's a permissions issue, however, I have installed Composer on another server and installed packages in the C:\inetpub\wwwroot directory without a problem. I've tried comparing security group permissions between the two servers for wwwroot and inetpub, and the permissions were the same. I had someone suggest trying to copy the .json file to My Documents on the server and try running composer install from there, and that worked. Which further indicates it's a permissions issue, but I can't figure out what.

After re-reading another Linux question, I figured out what the problem was. I need to be running Command Prompt as administrator. Now it works.

Please ensure that whether your deployment folder is having composer.lock file or not.' If not please deploy the file there.

Related

cannot run composer command in project root

I am trying to run laravel project in cPanel.
The problem is that composer runs outside the project root directory but not inside the project having composer.jsonfile.
cPanel returns Killed when i try to run composer as in the image below:
Edit:
Looking on the comments i have tried to run composer --help but still there is Killed issue.
I have upgraded the memory limit to 1024M from custom php.ini file as:
but it is not yet changing in the terminal:
Could it be php configuration issues or some server issues?
Can anyone shed some light on this issue? I can update the question if it is not clear.
It looks like your server runs out of memory when composer is executed thus the error message : Killed.
If you have access to more resources you might try to increase the ram and try again, otherwise you can just composer install on your local machine and upload the vendor folder to get you going for now until you sort the memory issue on your server.
Edit: from the screenshots I noticed that you didn't upload the composer.lock file, you might want to try uploading that file and simply run composer install as it's should require much less memory than composer update (since the dependencies won't be resolved on your live server but simply installed according to the hashes in your composer.lock file).

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.

Insufficient permissions when installing laravel in Onedrive folder

I am currently trying to do a new Laravel install in a Onedrive folder with the following command:
laravel new blog or composer create-project --prefer-dist laravel/laravel blog
Unfortunately, I get the following error:
PHP Warning: file_put_contents(C:\Users\jordy\OneDrive\Websites\www.blog.nl/laravel_7198089e82dcd0b2debf8486652dfae3.zip): failed to open stream: Permission denied in C:\Users\jordy\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 133, including a few similar ones.
I run my command prompt as an Administrator on Windows 10, and my user account has full permissions on the Onedrive folder. If I try to do it in another directory outside the Onedrive, it works correctly.
How is this possible? Does Onedrive blocks something?
Found out that Bitdefender AntiVirus was the problem. I went to Application Access (under the Safe Files settings), and gave permissions to Apache and PHP CLI. Now it works.
(Running php files stored on OneDrive)
Actually, this also fixes the blank page issue on Laravel installations.

Laravel Homestead (Windows) how to add vendor to PATH

I've set up my Homestead and i am able to connect via vagrant ssh.
I also add Laravel installer over Composer via composer global require laravel/installer.
But know, i don't know how to make it work cause in the vagrant user folder, there is no .composer/vendor folder. i figured out that the composer has installed the vendor folder under /root/.composer but when i try to access, i don't have permission cause it's in root folder.
My goal is to use the Laravel installer. For that, i need to add the path to the $PATH. Here the guideline from the docu:
Make sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system
But i can't do that in vagrant or at least i don't know how.
And yes, i know that composer is installed, that part worked.
So how can i make it work?
I fixed it.
For all others with the same issue: i need to run as administrator and i also had an outdated vagrantbox

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