5

On deploying my application through Laravel Forge, I'm presented with the following errors:

Fatal error: Class 'Illuminate\Support\Arr' not found in
/home/forge/toono.co/vendor/laravel/framework/src/Illuminate/Support/helpers.php
on line 151

This is after the composer update command has ran. I have SSH'd into the directory and low and behold, the file Arr.php doesn't exist.

The code is pulled from the master branch in BitBucket, and then the following lines are executed on the production server:

cd /home/forge/default
git pull origin master
composer install
php artisan migrate --force

Composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "laravel/framework": "4.2.*"
    },
    "require-dev": {
        "way/generators": "2.*",
        "fzaninotto/faker": "1.4.*@dev",
        "barryvdh/laravel-debugbar": "1.*",
        "flynsarmy/csv-seeder": "1.0.*"
    },
    "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 debugbar:publish",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

Composer.lock:

"require": {
    "codesleeve/stapler": "~1",
    "laravel/framework": "~4",
    "php": ">=5.4.0"
}

Why has composer update missed that file? After a local update and even on the master branch in Github, Arr.php is there?

If I am missing any necessary code that you require, please let me know.

Any help would be greatly appreciated.

joemaller
  • 19,579
  • 7
  • 67
  • 84
  • Arr.php is new in 4.2. Does your live server's composer.json specify 4.2? – ceejayoz Sep 02 '14 at 18:47
  • `"require": { "laravel/framework": "4.2.*",` is the liver server's composer.json file. –  Sep 02 '14 at 18:51
  • There are obviously two machines involved: One to develop, and one to execute the code in "production". How does the code get from the one machine to the other? What happens after the code got onto that "production" machine? Any scripts/commands executed - which? Can you give us both the `composer.json` and `composer.lock` files of your project? (Shorten the latter one to relevant entries related to the offending Laravel packages, if possible). Adding the output of you running `composer install` on the prod machine may also help. – Sven Sep 03 '14 at 00:53
  • Hi @Sven, thank you for your reply. The code gets from local to production via BitBucket, Laravel Forge then pulls in the master branch from BitBucket and deploys it. The script used to execute on the production is - `cd /home/forge/default` `git pull origin master` `composer install` `php artisan migrate --force`. All other code added above for extra clarity. Thank you. –  Sep 04 '14 at 20:31
  • Add `composer self-update` to your deploy script. – joemaller Sep 05 '14 at 14:55
  • `...even on the master branch in Github, Arr.php is there...` why is Arr.php in your master branch?? It is in the `\vendor` folder, which should be ignored and never committed to the github storage. You should remove the entire `/vendor` folder and then just run a clean `composer install` – Laurence Sep 06 '14 at 09:50
  • @TheShiftExchange, my apologies, /vendor is ignored. Composer installs all vendor packages within the production server. –  Sep 06 '14 at 16:01

2 Answers2

3

I solved this by deleting composer.lock and the vendor folder within the production server. I then used composer update.

0

I solved this by ssh'ing into the box via commandline (ssh forge@ip.of.server)

if you don't know how to ssh into the server, you go to forge -> the server -> SSH Keys.

There you add your public key (if you have not setup ssh keys follow this guide: https://help.github.com/articles/generating-ssh-keys).

If you have ssh keys setup, you simply open terminal and paste the following command and run it; "pbcopy < ~/.ssh/id_rsa.pub", this will copy your public key to your clipboard and you can simply paste that into the ssh key field in forge.

Now i can ssh into the server.

I then navigated to the default folder (cd /home/forge/default) and ran "composer update"

It updates everything and it worked after that.

Ditlev
  • 60
  • 7