Skip to content

Install fails with fresh, bone-stock Laravel instance. #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
unrivaledcreations opened this issue Jul 24, 2021 · 10 comments · Fixed by #840
Closed

Install fails with fresh, bone-stock Laravel instance. #838

unrivaledcreations opened this issue Jul 24, 2021 · 10 comments · Fixed by #840

Comments

@unrivaledcreations
Copy link

  • Jetstream Version: ^1.3|^2.0 (via composer.json)
  • Jetstream Stack: Inertia / (N/A)
  • Uses Teams: yes / no (N/A)
  • Laravel Version: 8.51.0
  • PHP Version: 8.0.8
  • Database Driver & Version: (N/A)

Description:

Getting a Composer error on install, using the command composer require laravel/jetstream:

Problem 1
    - laravel/jetstream[v2.3.0, ..., 2.x-dev] require league/commonmark ^1.3 -> found league/commonmark[1.3.0, ..., 1.6.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires laravel/jetstream ^2.3 -> satisfiable by laravel/jetstream[v2.3.0, ..., 2.x-dev].

The bone-stock Laravel installation uses Jetstream v2 because vendor/laravel/framework/src/Illuminate/Mail/composer.json contains "league/commonmark": "^1.3|^2.0". However, Jetstream's composer.json requires "league/commonmark" "^1.3". This breaks the installation process because the core Laravel framework already installed v2.x when Jetstream seems to insist on v1.3 (of the league/commonmark dependency).

Steps To Reproduce:

laravel new test
cd test
composer require laravel/jetstream

The single command, laravel new --jet --stack=inertia test, also fails for the same reason.

Workaround:

Manually adding "league/commonmark": "^1.3", to the root composer.json project file before composer require laravel/jetstream seems to work around the problem.

@jonatandorozco
Copy link

I confirm the issue with

  • PHP: 8.0.6
  • Stack: Livewire

It happens on fresh install and the workaround mentioned by @unrivaledcreations works

@zamarproject
Copy link

I had the same issue.
I tried your suggestion but didn´t work.
I placed "league/commonmark": "^1.3" in the root composer.json project file:

"require": {
    "php": "^7.3|^8.0",
    "fideloper/proxy": "^4.4",
    "fruitcake/laravel-cors": "^2.0",
    "guzzlehttp/guzzle": "^7.0.1",
    "league/commonmark": "^1.3",   <-- right there...        
    "laravel/framework": "^8.40",
    "laravel/tinker": "^2.5"
},

Then, I launched "composer require laravel/jetstream" and also I tried with "laravel new --jet --stack=inertia test"
and the same error message.
Any suggestion?
:( 

@daffigusti
Copy link

after you put
"league/commonmark": "^1.3"
on composer.json
You must delete composer.lock before you run composer require laravel/jetstream.

It works for me.

@juanjo1307
Copy link

same issue with inertia
Problem 1
- laravel/jetstream[v2.3.0, ..., 2.x-dev] require league/commonmark ^1.3 -> found league/commonmark[1.3.0, ..., 1.6.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires laravel/jetstream ^2.3 -> satisfiable by laravel/jetstream[v2.3.0, ..., 2.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

@zamarproject
Copy link

zamarproject commented Jul 25, 2021 via email

@zamarproject
Copy link

zamarproject commented Jul 25, 2021 via email

@driesvints
Copy link
Member

Tagged v2.3.12 with a fix. Thanks everyone for reporting.

@romsar
Copy link
Contributor

romsar commented Jul 27, 2021

Guys, do you still have this problem as me?
Currently Jetstream is calling this class:
use League\CommonMark\Environment;

I'm using CommonMark ver 2.0 and this package does not contain this class.
It have League\CommonMark\Environment\Environment (not League\CommonMark\Environment)

So, after updating packages on my app It broke and I need to manually put ^1.3 on my composer.json.

@mikeroq
Copy link
Contributor

mikeroq commented Jul 27, 2021

@RomanSarvarov commonmark 2.0 deprecates and changes quite a few things. This breaks the implementation that jetstream is using for the Terms/Privacy Policy feature.

You can work around by updating the Controllers in the vendor folder with the new way to use the GithubFlavoredMarkdownConverter.

TermsOfServiceController:

<?php

namespace Laravel\Jetstream\Http\Controllers\Livewire;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Laravel\Jetstream\Jetstream;
use League\CommonMark\GithubFlavoredMarkdownConverter;

class TermsOfServiceController extends Controller
{
    /**
     * Show the terms of service for the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\View\View
     */
    public function show(Request $request)
    {
        $termsFile = Jetstream::localizedMarkdownPath('terms.md');

        return view('terms', [
            'terms' => (new GithubFlavoredMarkdownConverter())->convertToHtml(file_get_contents($termsFile)),
        ]);
    }
}

PrivacyPolicyController:

<?php

namespace Laravel\Jetstream\Http\Controllers\Livewire;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Laravel\Jetstream\Jetstream;
use League\CommonMark\GithubFlavoredMarkdownConverter;

class PrivacyPolicyController extends Controller
{
    /**
     * Show the privacy policy for the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\View\View
     */
    public function show(Request $request)
    {
        $policyFile = Jetstream::localizedMarkdownPath('policy.md');

        return view('policy', [
            'policy' => (new GithubFlavoredMarkdownConverter())->convertToHtml(file_get_contents($policyFile)),
        ]);
    }
}

@driesvints
Copy link
Member

Tagged v2.3.14 with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants