0

I'm new to Laravel so you may have to bear with me, but I seem to be having a small issue. Now first of all I've created a basic template and managed to get it to run using phpMyAdmin with Wamp and it worked fine. I've also been given an old project that I've been asked to take a look at but for some reason I can't get it to run.

So this is the process I'm using:

1: Opened cmd change to the correct directory

2: Install the composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

3: Change directory to the project directory

4: Run php artisan key:generate

ERROR:

PHP Warning: require(C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php): failed to open stream: No such file or directory in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

Warning: require(C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php): failed to open stream: No such file or directory in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54 PHP Fatal error: require(): Failed opening required 'C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php' (include_path='C:\xampp\php\PEAR') in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

Fatal error: require(): Failed opening required 'C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php' (include_path='C:\xampp\php\PEAR') in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

C:\wamp64\www\pmanager\websiteprojectNew\websiteproject>php artisan migrate PHP Warning: require(C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php): failed to open stream: No such file or directory in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

Warning: require(C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php): failed to open stream: No such file or directory in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54 PHP Fatal error: require(): Failed opening required 'C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php' (include_path='C:\xampp\php\PEAR') in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

Fatal error: require(): Failed opening required 'C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php' (include_path='C:\xampp\php\PEAR') in C:\wamp64\www\pmanager\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

Updated error after installing Git

Warning: require(C:\wamp64\www\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php): failed to open stream: No such file or directory in C:\wamp64\www\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54

Fatal error: require(): Failed opening required 'C:\wamp64\www\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php' (include_path='C:\xampp\php\PEAR') in C:\wamp64\www\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54 PHP Warning: require(C:\wamp64\www\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php): failed to open stream: No such file or directory in C:\wamp64\www\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54 PHP Fatal error: require(): Failed opening required 'C:\wamp64\www\websiteprojectNew\websiteproject\vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php' (include_path='C:\xampp\php\PEAR') in C:\wamp64\www\websiteprojectNew\websiteproject\vendor\composer\autoload_real.php on line 54 Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255

Composer Install Command Output:

Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. Package operations: 51 installs, 0 updates, 0 removals - Installing golonka/bbcodeparser (v2.1.0): Downloading (failed) Failed to download golonka/bbcodeparser from dist: The "https://api.github.com/repos/golonka/BBCodeParser/zipball/d597b1c0a6472ff7003776dd5c74e084270da041" file could not be downloaded (HTTP/1.1 404 Not Found) Now trying to download from source - Installing golonka/bbcodeparser (v2.1.0): Cloning d597b1c0a6

[RuntimeException] Failed to clone https://github.com/golonka/BBCodeParser.git, git was not found, check that it is installed and in your PATH env.

'git' is not recognized as an internal or external command,
operable program or batch file.

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] []...

Composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "illuminate/html": "^5.0",
        "golonka/bbcodeparser": "~2.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "myproject\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}
Matt Hutch
  • 453
  • 1
  • 6
  • 20

1 Answers1

0

According to your errors there are two reason this could happen.

No git installed

'git' is not recognized as an internal or external command, operable program or batch file.

to resolve this install git and see whether git commands working on the console

You have added deleted packages

Failed to clone https://github.com/golonka/BBCodeParser.git, git was not found, check that it is installed and in your PATH env.

see whether there's a package called golonka/bbcodeparser in our composer.json and delete it

after resolving these two run composer install in your project folder see whether its working or not. after that you can run php artisan key:generate

Supun Praneeth
  • 3,087
  • 2
  • 30
  • 33
  • Hi there, thanks for answering. I've added a copy of my composer.json to the post finished installing Git. I then tried removing the `golonka/bbcodeparser` that appears on line 10 and then tried the `composer install` commarnd and got "composer.json" does not contain valid JSON" – Matt Hutch Mar 22 '18 at 09:21
  • @MattHutch remove composer.lock file and run composer clear-cache then run it again, your composer.json file is fine, i checked it and there are no any erros – Supun Praneeth Mar 22 '18 at 09:32
  • Still no joy, it's still outputting the error in the post. – Matt Hutch Mar 22 '18 at 09:40
  • I've added a updated output error to the post so you can see it. – Matt Hutch Mar 22 '18 at 09:42
  • @MattHutch this one : [RuntimeException] Failed to clone https://github.com/golonka/BBCodeParser.git, git was not found, check that it is installed and in your PATH env. ?? – Supun Praneeth Mar 22 '18 at 09:44
  • When I run the `git.exe` command in a fresh cmd it outputs the user help, doesn't that mean it's installed – Matt Hutch Mar 22 '18 at 09:46
  • @MattHutch yes, im asking whats the error you getting, there are few errors in your post – Supun Praneeth Mar 22 '18 at 09:48
  • I get this when I run `composer install` or `composer update` – Matt Hutch Mar 22 '18 at 09:51
  • @MattHutch can you type just `composer ` and see if you get any errors – Supun Praneeth Mar 22 '18 at 09:53
  • @MattHutch well that's weird, you could get that error if you run `php artisan key:generate` without composer update, i believe this is your project folder C:\wamp64\www\websiteprojectNew\websiteproject right ? so when you run `composer update` composer never need to require your project vendor file. so delete vendor in your project folder and the lock file an try it again, you are not using composer.phar right ? – Supun Praneeth Mar 22 '18 at 10:05