热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Laravel4.2-作曲家更新问题-Laravel4.2-composerupdateissue

ItriedtoruncomposerinstallandcomposerupdateasusualbeforeworkingwithaLaravelproject.

I tried to run composer install and composer update as usual before working with a Laravel project. However I encountered a weird issue that I can't seem to solve for quite a while.

在使用Laravel项目之前,我尝试像往常一样运行composer install和composer update。然而,我遇到了一个奇怪的问题,我似乎很久都无法解决。

PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7:35
Stack trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleError(2, 'Invalid argumen...', '/Applications/X...', 35, Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications/X...')
#2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\Engines\PhpEngine->evaluatePath('/Applications/X...', Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEngine->get('/Applications/X...', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 on line 35
PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7:35
Stack trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleError(2, 'Invalid argumen...', '/Applications/X...', 35, Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications/X...')
#2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\Engines\PhpEngine->evaluatePath('/Applications/X...', Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/framework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEngine->get('/Applications/X...', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 on line 35
Script php artisan clear-compiled handling the post-update-cmd event returned with an error


  [RuntimeException]                                                           
  Error Output: PHP Fatal error:  Uncaught exception 'ErrorException' with me  
  ssage 'Invalid argument supplied for foreach()' in /Applications/XAMPP/xamp  
  pfiles/htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de  
  3dc7:35                                                                      
  Stack trace:                                                                 
  #0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d  
  4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleEr  
  ror(2, 'Invalid argumen...', '/Applications/X...', 35, Array)                
  #1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram  
  ework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications  
  /X...')                                                                      
  #2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram  
  ework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\E  
  ngines\PhpEngine->evaluatePath('/Applications/X...', Array)                  
  #3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram  
  ework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEn  
  gine->get('/Applications/X...', Array)                                       
  #4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles  
  /htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 o  
  n line 35                                                                    
  PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Invalid  
   argument supplied for foreach()' in /Applications/XAMPP/xamppfiles/htdocs/  
  wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7:35         
  Stack trace:                                                                 
  #0 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/app/storage/views/d  
  4682a7a7da163c9444d69f6b6de3dc7(35): Illuminate\Exception\Handler->handleEr  
  ror(2, 'Invalid argumen...', '/Applications/X...', 35, Array)                
  #1 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram  
  ework/src/Illuminate/View/Engines/PhpEngine.php(35): include('/Applications  
  /X...')                                                                      
  #2 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram  
  ework/src/Illuminate/View/Engines/CompilerEngine.php(56): Illuminate\View\E  
  ngines\PhpEngine->evaluatePath('/Applications/X...', Array)                  
  #3 /Applications/XAMPP/xamppfiles/htdocs/wild-guanabana/vendor/laravel/fram  
  ework/src/Illuminate/View/View.php(134): Illuminate\View\Engines\CompilerEn  
  gine->get('/Applications/X...', Array)                                       
  #4 /Applications/XAMPP/xamppfiles/htdocs/ in /Applications/XAMPP/xamppfiles  
  /htdocs/wild-guanabana/app/storage/views/d4682a7a7da163c9444d69f6b6de3dc7 o  
  n line 35                                             

After googling this issue, I tried the following solutions but none of them worked:

在谷歌搜索这个问题后,我尝试了以下解决方案,但都没有成功:

  1. removing vendor folder and composer.lock and then running composer install
  2. 删除供应商文件夹和编写器。锁定,然后运行composer安装。
  3. removing bootstrap/compiled.php and then running composer update
  4. 删除引导/编译。然后运行composer更新
  5. running php artisan cache:clear or php artisan views:clear to empty the storage/views directory. php artisan also does not work
  6. 运行php artisan缓存:清除或php artisan视图:清除存储/视图目录。php artisan也不工作
  7. I tried removing storage/views manually but it also failed
  8. 我尝试手动删除存储/视图,但也失败了
  9. composer update --no-scripts.
  10. 作曲家更新——没有剧本。

I changed the folder's permission to 777 just in case it was a permission issue but it also failed.

我将文件夹的权限更改为777,以防这是一个权限问题,但它也失败了。

Here's composer.json just in case:

这是作曲家。json以防:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "laravel/framework": "4.2.7"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

UPDATE:

更新:

so I kept tracing the error I was getting from storage/views to find it in the first foreach loop:

所以我一直跟踪我从存储/视图中得到的错误,在第一个foreach循环中找到它:


Adding to that I find the url function preceded by _ which as far as I remember Laravel 4.2 was not there, you just write url('url here'). Also the en and ar follow the same issue. The first foreach loop keep stating Invalid argument supplied for foreach, which is weird since I can't use php artisan to migrate the database or even seed it.

另外,我发现url函数前面有_,我记得Laravel 4.2没有,你只需写url('url here')。en和ar也遵循同样的问题。第一个foreach循环继续声明为foreach提供的无效参数,这很奇怪,因为我不能使用php artisan来迁移数据库,甚至不能对它进行种子。

What is more weird is that the same code is currently live and working normally.

更奇怪的是,同样的代码现在是正常工作的。

Any idea what could be the issue here?!

你知道这里有什么问题吗?

2 个解决方案

#1


0  

have you tried the sudo composer install/update? I had similar issues today and fixed it with sudo

你试过sudo composer安装/更新吗?我今天遇到了类似的问题,用sudo解决了

#2


0  

Although this is weird, but I found the error. The host in the database configuration was set to localhost and for some unknown reason it was not working and giving the errors stated above. I changed it to 127.0.0.1 and it worked normally.

虽然这很奇怪,但是我发现了错误。数据库配置中的主机被设置为localhost,出于某种未知原因它不能工作,并给出上面所述的错误。我把它改成了127.0.0.1,它正常工作。

I can not figure out the real reason since there is nothing related to this part in the error trace.

我无法找出真正的原因,因为在错误跟踪中与这部分没有任何关系。


推荐阅读
  • phpcomposer 那个中文镜像是不是凉了 ... [详细]
  • NSSROUND#8[Basic]
    文章目录一、[NSSRound#8Basic]MyDoor二、[NSSRound#8Basic]Upload_gogoggo三、[NSSRound#8Basic]MyPage四、[ ... [详细]
  • ASP.NETCoreZero笔记(PowerTools)
    安装ASP.NETCoreZeroPowerTool根据官方的介绍,使用该工具,可以快速得创建具备单个表结构及父子表结构的服务以及前端页面。服务:指的是生产对应基础功能webApi ... [详细]
  • syncd是一款开源的代码部署工具,它具有简单、高效、易用等特点,可以提高团队的工作效率. ... [详细]
  • php composer 安装,phpstudy  composer 使用安装
    本人是windows系统phpstudy是最新2018版本以安装laravel框架为例子一如图一,点击phpComposer出现系统指令框,根据指令框路 ... [详细]
  • windows下composer命令无效的解决办法
    开发工具|composerwindows,composer开发工具-composer下面由composer教学栏目给大家介绍windows下composer安装不了或compose ... [详细]
  • 作业迁移
    背景:数据库服务器更换,1、数据库迁移(BACKUPRESTORE);2、数据库登录名用户迁移(注意孤立用户);3、作业迁移数据库迁移,备份数据库、拷贝备份文件到新服务器,还原数据 ... [详细]
  •  //CAUTION:Followtheconfigurationorderforsettingtheports.   //1)settingva ... [详细]
  • 一安装配置1.配置文件mongod.cfg(路径:D:\data\config\mongod.cfg)如下:    systemLog:destination ... [详细]
  • 1、获取类身上的成员变量--class_copyIvarListif([badgeViewChildisKindOfClass:NSClassFromString(_UIBadg ... [详细]
  • 也就是|小窗_卷积的特征提取与参数计算
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了卷积的特征提取与参数计算相关的知识,希望对你有一定的参考价值。Dense和Conv2D根本区别在于,Den ... [详细]
  • 本文介绍了Composer依赖管理的重要性及使用方法。对于现代语言而言,包管理器是标配,而Composer作为PHP的包管理器,解决了PEAR的问题,并且使用简单,方便提交自己的包。文章还提到了使用Composer能够避免各种include的问题,避免命名空间冲突,并且能够方便地安装升级扩展包。 ... [详细]
  • 【前端工具】nodejs+npm+vue 安装(windows)
    预备先看看这几个是干嘛的,相互的关系是啥。nodejs是语言,类比到php。npm是个包管理,类比到composer。vue是个框架&# ... [详细]
  • 如何通过swoole加速laravel的问题?
    这篇文章主要介绍了关于如何使用swoole加速laravel,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下再来复习一下吧,导致php慢的各种因素中解析性语言的 ... [详细]
  • laravel 使用腾讯云 COS5全教程
    laravel使用腾讯云COS5全教程一下载首先第一步肯定是用composer把包安装下来,这里是laravel5.8版本的,所以我用的是cos5 ... [详细]
author-avatar
手机用户2502863087
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有