1

I have checked out many examples of this but for some reason, either I am missing an assumed step or I'm just doing it wrong.

So I am having issues getting Laravel installed locally. I have a composer.json and .phar file.

I have ran php composer install which downloaded the dependencies. However, this is where it gets different. Seems at this point all the examples I have found are magically working. However in mine, I have a vendor directory with all the dependencies but nothing is actually installed. I have the Laravel source but its not ready for development yet.

Does this make sense? Am I over complicating things?

I am now getting an error:

Script php artisan optimize handling the post-update-cmd event returned with error code 1

which after checking, that method is there...

My composer.json:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
  "php": ">=5.6.4",
  "laravel/framework": "5.4.*",
  "laravel/tinker": "~1.0",
  "barryvdh/laravel-cors": "^0.8.2"
},
"require-dev": {
  "fzaninotto/faker": "~1.4",
  "mockery/mockery": "0.9.*",
  "phpunit/phpunit": "~5.7"
},
"autoload": {
  "psr-4": {
    "App\\": "app/"
  }
},
"autoload-dev": {
  "psr-4": {
    "Tests\\": "tests/"
  }
},
"scripts": {
  "post-root-package-install": [
    "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
  ],
  "post-create-project-cmd": [
    "php artisan key:generate"
  ],
  "post-install-cmd": [
    "Illuminate\\Foundation\\ComposerScripts::postInstall",
    "php artisan optimize"
  ],
  "post-update-cmd": [
    "Illuminate\\Foundation\\ComposerScripts::postUpdate",
    "php artisan optimize"
  ]
},
"config": {
  "preferred-install": "dist"
}

}

8
  • 1
    what do you mean by I have a vendor directory with all the dependencies but nothing is actually installed ?? Anything you install using composer goes into vendor directory Commented Feb 24, 2017 at 18:08
  • right, so how do i get laravel setup properly? i have /vendor/laravel/framework/ and then some stuff in there. This isn't where you do development at. Isn't there a step somewhere that does things with these dependencies? Commented Feb 24, 2017 at 18:11
  • You should have The app Directory, The bootstrap Directory, The config Directory, The database Directory, The public Directory, The resources Directory, The routes Directory, The storage Directory, The tests Directory and the The vendor Directory. In your root Commented Feb 24, 2017 at 18:14
  • If composer downloaded all the dependencies properly then your project is set up. just hit http://localhost/your_project_folder/public. and you do not do any development in vendor folder. And please go through the docs Commented Feb 24, 2017 at 18:15
  • 2
    Have you tried this: composer create-project laravel/laravel blog Commented Feb 25, 2017 at 10:28

1 Answer 1

4

It looks like you may have downloaded Laravel itself instead of creating a Laravel project.

The Installing Laravel section of the documentation shows two ways to create a Laravel project:

Via Laravel Installer

First, download the Laravel installer using Composer:

composer global require "laravel/installer"

Make sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system.

Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog will create a directory named blog containing a fresh Laravel installation with all of Laravel's dependencies already installed:

laravel new blog

Via Composer Create-Project

Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:

composer create-project --prefer-dist laravel/laravel blog

After doing either of these your project directory should include the proper Laravel directories with all dependencies properly set up.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.