Closed judodan closed 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?
Wow, thanks for quick response. Composer was definitely out of date.
Unfortunately, I updated composer to 1.9.0 and experiencing same issue.
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.
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
Installing laravel/valet (v2.4.2): Loading from cache symfony/service-contracts suggests installing symfony/service-implementation symfony/console suggests installing symfony/event-dispatcher symfony/console suggests installing symfony/lock symfony/console suggests installing psr/log (For using the console logger) guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses) guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware) symfony/translation suggests installing symfony/config symfony/translation suggests installing symfony/yaml illuminate/support suggests installing illuminate/filesystem (Required to use the composer class (^6.0).) illuminate/support suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).) illuminate/support suggests installing ramsey/uuid (Required to use Str::uuid() (^3.7).) illuminate/support suggests installing vlucas/phpdotenv (Required to use the Env class and env helper (^3.3).) Writing lock file Generating autoload files izz@Daniels-MacBook-Pro:.composer $ php -v PHP 7.3.8 (cli) (built: Aug 14 2019 16:42:46) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies izz@Daniels-MacBook-Pro:.composer $ which php /Applications/MAMP/bin/php/php7.3.8/bin//php izz@Daniels-MacBook-Pro:.composer $ cd ../Development/ izz@Daniels-MacBook-Pro:Development $ laravel new brackets.lan 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.
Hm, I'm not sure if this is the source of the problem, but I would definitely try two things:
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.
Hm, I'm not sure if this is the source of the problem, but I would definitely try two things:
- "laravel new brackets" instead of "laravel new brackets.lan" to start
Did not seem to make a difference.
- 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!
@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
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.
OK :)
What a passion to help others @mattstauffer , thanks.
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.
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)