简体   繁体   English

Composer 无法打开流:权限被拒绝

[英]Composer failed to open stream: Permission denied

am trying to install illuminate/html package in Laravel 5.1 using command composer require illuminate/html .我正在尝试使用命令composer require illuminate/html invoice illuminate/html在 Laravel 5.1 中安装illuminate/html包。 But I get this error.但我收到这个错误。

[ErrorException]                                                             
file_put_contents(C:\ProgramData\ComposerSetup\bin): 
failed to open stream:  Permission denied

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update]
[--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] 
[--sort-packages] [packages1] ... [packagesN]

I believe Problem is permission to access that folder, I tried to remove read only protection but the protection return by default.我相信问题是访问该文件夹的权限,我尝试删除只读保护,但默认情况下保护返回。

Am running Windows10我正在运行 Windows10

I had a similar problem recently, and needed to change the permissions of my folders.我最近遇到了类似的问题,需要更改文件夹的权限。

By running: php artisan cache:clear chmod -R 777 storage vendor composer dump-autoload通过运行: php artisan cache:clear chmod -R 777 storage vendor composer dump-autoload

I was able to give all the permissions required to open files and write to them etc我能够授予打开文件和写入文件等所需的所有权限

Try running the Windows Command Prompt as an Administrator -- this worked for me.尝试以管理员身份运行Windows 命令提示符——这对我有用。

在此处输入图片说明

I had this problem too.我也有这个问题。 I put this solution here in case it works for someone else.我把这个解决方案放在这里,以防它适用于其他人。

On my system (Windows 10), I had marked both the vendor folder and the composer.json file in my project folder as hidden , because of reasons.在我的系统(Windows 10)上,由于原因,我将项目文件夹中的 vendor 文件夹和 composer.json 文件标记为hidden The error message went away when I unhid the folders and the json files, and ran the command again.当我取消隐藏文件夹和 json 文件并再次运行命令时,错误消息消失了。 I did not need to restart my command line in Administrator mode.我不需要在管理员模式下重新启动我的命令行。 (In fact, trying this in Administrator mode did not work either, until I changed the file and folder properties to unhidden.) (实际上,在管理员模式下尝试此操作也不起作用,直到我将文件和文件夹属性更改为未隐藏。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM