我正在尝试在Laravel中制作一个新的控制器。当我在CMD窗口中键入以下命令时:
php artisan make:controller CheckoutController
我收到此错误
ErrorException : file_get_contents(C:xampphtdocsiezonsolutionscomposer.j
son): failed to open stream: No such file or directory
at C:xampphtdocsiezonsolutionsvendorlaravelframeworksrcIlluminateFoun
dationApplication.php:1155
1151| if (! is_null($this->namespace)) {
1152| return $this->namespace;
1153| }
1154|
> 1155| $composer = json_decode(file_get_contents(base_path('composer.
json')), true);
1156|
1157| foreach ((array) data_get($composer, 'autoload.psr-4') as $nam
espace => $path) {
1158| foreach ((array) $path as $pathChoice) {
1159| if (realpath(app_path()) == realpath(base_path().'/'.$
pathChoice)) {
Exception trace:
1 file_get_contents("C:xampphtdocsiezonsolutionscomposer.json")
C:xampphtdocsiezonsolutionsvendorlaravelframeworksrcIlluminateFou
ndationApplication.php:1155
2 IlluminateFoundationApplication::getNamespace()
C:xampphtdocsiezonsolutionsvendorlaravelframeworksrcIlluminateCon
soleGeneratorCommand.php:225
在将 Stripe PHP 安装到我的作曲家后,我才开始收到此错误:
composer global require stripe/stripe-php
这给了我输出:
C:xampphtdocsiezonsolutions>composer global require stripe/stripe-php
Changed current directory to C:/Users/user/AppData/Roaming/Composer
Using version ^6.28 for stripe/stripe-php
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing stripe/stripe-php (v6.28.0): Loading from cache
Writing lock file
这似乎删除了我的composer.json
文件并重新创建为.lock
文件。我该如何解决这个问题?
请尝试以下步骤:
- 删除 .lock 文件
- 从应用程序目录运行
composer require stripe/stripe-php
(非全局) - 您可能需要重新运行作曲家安装或作曲家更新