GrahamCampbell / Laravel-Markdown

A CommonMark wrapper for Laravel
https://gjcampbell.co.uk/
MIT License
1.32k stars 139 forks source link

Laravel 8 installation problem #158

Closed trianity closed 2 years ago

trianity commented 3 years ago

$ composer require graham-campbell/markdown:^13.1

./composer.json has been updated

Running composer update graham-campbell/markdown Loading composer repositories with package information

Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1

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

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

colinodell commented 3 years ago

It sounds like you might currently have league/commonmark 2.0.0 installed, but the version of graham-campbell/markdown you're trying to install is not compatible with 2.0.0. If you use the -W flag as mentioned in the output, Composer will downgrade that package to a compatible version for you.

raysn0w commented 3 years ago

I have the same issue with a fresh Laravel install. Using -W doesn't work either.

`Your requirements could not be resolved to an installable set of packages.

Problem 1

trianity commented 3 years ago

It sounds like you might currently have league/commonmark 2.0.0 installed, but the version of graham-campbell/markdown you're trying to install is not compatible with 2.0.0. If you use the -W flag as mentioned in the output, Composer will downgrade that package to a compatible version for you.

Hello, I tried to do it, but the Laravel 8 core has already installed league/commonmark 2.0.0. The solution was to clone GrahamCampbell/Laravel-Markdown, make offline package from it and correct the composer.json to use the proper league/commonmark 2.0.0.

bastinald commented 3 years ago

same issue here.

subtain-haider commented 3 years ago

am facing same issue

888op commented 3 years ago

Hello, I tried to do it, but the Laravel 8 core has already installed league/commonmark 2.0.0. The solution was to clone GrahamCampbell/Laravel-Markdown, make offline package from it and correct the composer.json to use the proper league/commonmark 2.0.0.

Hello, did it work to you? If it worked to you, can I know how to do it? I'm still new in using Laravel and I don't know how to install offline package in Laravel. I've tried something like this but it didn't work for me. Thank you.

trianity commented 3 years ago

Hello, I tried to do it, but the Laravel 8 core has already installed league/commonmark 2.0.0. The solution was to clone GrahamCampbell/Laravel-Markdown, make offline package from it and correct the composer.json to use the proper league/commonmark 2.0.0.

Hello, did it work to you? If it worked to you, can I know how to do it? I'm still new in using Laravel and I don't know how to install offline package in Laravel. I've tried something like this but it didn't work for me. Thank you.

  1. Create a folder /packages/vendor-name/package-name
  2. In this folder setup your Laravel package (or copy of the mentioned package) Here you can find documentations: https://laravel.com/docs/8.x/packages Good tutorial with all necessary steps: https://devdojo.com/devdojo/how-to-create-a-laravel-package
  3. In your main Laravel composer.json file setup package access like this:
    "repositories": {
        "local01": {
            "type": "path",
            "url": "packages/vendor-name/package-name"
        }
    },
    "require": {
    ... all other required packages, and at the and: ...
        "vendor-name/package-name": "*"
    },
  4. After this setup you can modify the package. Don't forget to change the necessary name-space settings in all files of the package.
888op commented 3 years ago

Hello, I tried to do it, but the Laravel 8 core has already installed league/commonmark 2.0.0. The solution was to clone GrahamCampbell/Laravel-Markdown, make offline package from it and correct the composer.json to use the proper league/commonmark 2.0.0.

Hello, did it work to you? If it worked to you, can I know how to do it? I'm still new in using Laravel and I don't know how to install offline package in Laravel. I've tried something like this but it didn't work for me. Thank you.

  1. Create a folder /packages/vendor-name/package-name
  2. In this folder setup your Laravel package (or copy of the mentioned package) Here you can find documentations: https://laravel.com/docs/8.x/packages Good tutorial with all necessary steps: https://devdojo.com/devdojo/how-to-create-a-laravel-package
  3. In your main Laravel composer.json file setup package access like this:
    "repositories": {
        "local01": {
            "type": "path",
            "url": "packages/vendor-name/package-name"
        }
    },
    "require": {
... all other required packages, and at the and: ...
        "vendor-name/package-name": "*"
    },
  1. After this setup you can modify the package. Don't forget to change the necessary name-space settings in all files of the package.

Hi, thank you for your response, but it is still an error for me that the class not found from config/app.php. Maybe I miss something, so I will try it later. Thank You very much once again.

yannoff commented 3 years ago

Had the same problem, here is the workaround I found (not ideal, but simple):

  1. Remove the composer lock file

    rm composer.lock
  2. Require the package

    composer req graham-campbell/markdown:^13.1
GrahamCampbell commented 2 years ago

Thank you everyone. This is an issue/limitation with composer. It is not smart enough to downgrade commonmark to allow installation of this package. The best thing to do for now is to add this package to your composer.json by hand and then run composer update. I will be releasing a new major version of this package soon, switching from commonmark v1 to v2, so stay tuned.