tighten / lambo

Quick new application creation with Laravel and Valet
MIT License
612 stars 52 forks source link

Error creating project #75

Closed judodan closed 5 years ago

judodan commented 5 years ago

Following directions from "Laravel: Up and Running, 2nd Edition". I get errors running it, and a a different set of files (from the book). Output is like so:


Creating new Laravel app tourney


Crafting application... Loading composer repositories with package information Installing dependencies (including require-dev) from lock file

[ErrorException] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

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] [--] []...

Application ready! Build something amazing.

After this is a bunch of git checkin stuff.

Then I notice different list of files (from book). Most are same, but most glowingly missing is the vendor directory. i'm hesitant to do a composer install because I'm not sure if the above error will cause issues.

Am I missing something ?? (New to Laravel, I hope the benefits outweigh the headaches of setting up)

mattstauffer commented 5 years ago

Well, your biggest problem is the author of that book is a big jerk.

:)

But in reality, it looks like your Composer is likely out of date:

https://github.com/laravel/framework/issues/26549#issuecomment-451404025

Would you try running composer selfupdate and then try again?

judodan commented 5 years ago

Wow, thanks for quick response. Composer was definitely out of date.

Unfortunately, I updated composer to 1.9.0 and experiencing same issue.

mattstauffer commented 5 years ago

OK.. so.. this will sound crazy, but the first thing I would do is to restart your machine. Easiest way to wipe out some of the dependency hell you might be in. Then, let's re-install your global dependencies.

(Be careful copying and pasting this! It has an rm -rf which, if pasted wrong, could wreak havoc on your computer. Use with caution.)

cd ~/.composer
rm -rf vendor
rm comopser.lock
composer install

You've now restarted and updated your global dependencies.

Do this, and let me know the output:

php -v
which php

Finally, skip Lambo for a second. This isn't a Lambo problem; it's a Laravel installer problem. So just try this:

cd ~/Sites
laravel new myproject

Ensure that you get the same errors, and then, if you don't mind, throw them in here so we can look at them.

judodan commented 5 years ago

OK, here's the output:

izz@Daniels-MacBook-Pro:~ $ cd .composer/ izz@Daniels-MacBook-Pro:.composer $ rm -rf vendor izz@Daniels-MacBook-Pro:.composer $ rm composer.lock izz@Daniels-MacBook-Pro:.composer $ composer install Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 31 installs, 0 updates, 0 removals

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] [--] []...

Application ready! Build something amazing.

mattstauffer commented 5 years ago

Hm, I'm not sure if this is the source of the problem, but I would definitely try two things:

  1. "laravel new brackets" instead of "laravel new brackets.lan" to start
  2. Don't use MAMP, at all if possible, but definitely not as your primary PHP install.

I'm still surprised you're seeing this error with modern Composer, because every answer I've seen to this problem on Google has referenced Composer version.

So... you MIGHT find temporary greater success bypassing the Laravel installer:

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

However, even if you do, we're still going to need to fix this problem eventually.

Since you have Valet installed, the main thing I think you're going to need to do is fix your PATH so the Valet (Homebrew)-installed PHP is in front of your MAMP php when you're running PHP from the command line. If you know how to do that, I'd recommend trying that; if not, let me know and I'll try to write it out a bit later.

judodan commented 5 years ago

Hm, I'm not sure if this is the source of the problem, but I would definitely try two things:

  1. "laravel new brackets" instead of "laravel new brackets.lan" to start

Did not seem to make a difference.

  1. Don't use MAMP, at all if possible, but definitely not as your primary PHP install.

I'm not sure how this makes a difference [from CLI], but I did that because the default PHP was 7.1 (which was giving me other errors). I can try to update that.

I'm still surprised you're seeing this error with modern Composer, because every answer I've seen to this problem on Google has referenced Composer version.

So... you MIGHT find temporary greater success bypassing the Laravel installer:

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

However, even if you do, we're still going to need to fix this problem eventually.

This seems to have worked. I understand you're looking to fix (and I'm willing help test if need be), but at least I can move on to the next piece! Thanks!

Since you have Valet installed, the main thing I think you're going to need to do is fix your PATH so the Valet (Homebrew)-installed PHP is in front of your MAMP php when you're running PHP from the command line. If you know how to do that, I'd recommend trying that; if not, let me know and I'll try to write it out a bit later.

If you can send the instructions, I can try that and see if it makes a difference.

Thanks for the quick support!

mattstauffer commented 5 years ago

@judodan Glad you got it working!!

I'm OK if we call this one "done" for now, since I think this is a Composer issue, not a Lambo issue.

But, I would definitely still recommend you use the Homebrew PHP; and Valet provides a version switcher so you can go between different versions there, rather than relying on MAMP for that.


If you have dotfiles through something like your .bashrc or .bash_profile or .zshrc, you'll edit the path in there. If you know which shell you're using (if you never set it, you'll be on Bash) you can figure out which file to edit.

So, pick the file--.zshrc if Zsh, .bash_profile (probably) if Bash--and then add a line (or edit the existing line) that points to Homebrew's source directory, and make sure it's at the TOP.

So, basically, at the top of your .bash_profile or whatever, you'd add this line:

export PATH="/usr/local/bin:$PATH"

Then close and re-open your Terminal, type which php, and hopefully you'll see this:

/usr/local/bin/php
judodan commented 5 years ago

OK, i'm ok with calling this 'Done'. I updated my default PHP and removed references to MAMP. Same issue, but like you said, I don't think it's necessarily a Lambo issue.

mattstauffer commented 5 years ago

OK :)

techguydev commented 4 years ago

What a passion to help others @mattstauffer , thanks.