PuPHPeteer php 桥接包无法在 Laravel 9 上安装

问题描述 投票:0回答:3

此包 nesk/puphpeteer 已存档,不再适用于 Laravel 9。然而,我相信有一些 forks 可以与 Laravel 9 一起使用,因为作曲家错误中的依赖项已在 fork 中更新。我在 composer 文档 中尝试了这些步骤,但似乎无法安装 fork 作为作曲家依赖项。任何正确方向的指导将不胜感激。

在我的

composer.json
我有这些新条目。

{
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/NigelCunningham/puphpeteer.git"
    }
],
"require": {
    "nesk/puphpeteer": "dev-dev"
}

}

当我运行

composer update
时,我收到以下错误:

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

Problem 1
    - Root composer.json requires nesk/puphpeteer dev-dev -> satisfiable by nesk/puphpeteer[dev-dev]."
laravel github composer-php puppeteer laravel-9
3个回答
4
投票

总结

在撰写本文时,https://github.com/NigelCunningham/puphpeteer.git 尚未为 Laravel 9 做好准备。

说明

我尝试在 Laravel v9.0.0 的第一个稳定版本上安装它(

composer create-project laravel/laravel example-app 9.0.0
)。

composer.json新条目

{
    "repositories": [
        {
            "url": "https://github.com/NigelCunningham/puphpeteer.git",
            "type": "git"
        }
    ],
    "require": {
        "nigelcunningham/puphpeteer": "^2.0.0"
    },

    "minimum-stability": "dev"
}

您可能需要安装或启用 PHP 的套接字扩展。

它引发了以下错误:

composer update

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

  Problem 1
    - symfony/process[v4.0.0-BETA1, ..., v4.4.10] require php ^7.1.3 -> your php version (8.1.6) does not satisfy that requirement.
    - symfony/process[v5.0.0-BETA1, ..., v5.0.0-RC1] require php ^7.2.9 -> your php version (8.1.6) does not satisfy that requirement.
    - symfony/process[v5.0.0, ..., v5.1.0-RC1] require php ^7.2.5 -> your php version (8.1.6) does not satisfy that requirement.
    - Root composer.json requires laravel/framework ^9.0 -> satisfiable by laravel/framework[v9.0.0-beta.1, ..., 9.x-dev].
    - Root composer.json requires nigelcunningham/puphpeteer ^2.0.0 -> satisfiable by nigelcunningham/puphpeteer[2.0.0].
    - Conclusion: don't install symfony/console[v6.0.19] | install symfony/process[v5.4.19] (conflict analysis result)
    - Conclusion: don't install symfony/console[v6.0.3] | install symfony/process[v5.4.19] (conflict analysis result)
    - Conclusion: don't install nunomaduro/collision[v6.4.0] | install symfony/process[v5.4.19] (conflict analysis result)
    - Conclusion: don't install symfony/process v5.4.19 (conflict analysis result)
    - Conclusion: don't install symfony/console[v6.2.5] | install symfony/process[v5.4.19] (conflict analysis result)
    - nigelcunningham/puphpeteer 2.0.0 requires nesk/rialto ^1.2.0 -> satisfiable by nesk/rialto[1.2.0, 1.2.1, 1.3.0, 1.4.0].
    - nesk/rialto 1.4.0 requires symfony/process ^3.3|^4.0|^5.0 -> satisfiable by symfony/process[v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev].
    - nesk/rialto[1.2.0, ..., 1.3.0] require symfony/process ^3.3|^4.0 -> satisfiable by symfony/process[v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev].
    - symfony/console 6.3.x-dev conflicts with symfony/process v5.3.14.
    - symfony/console 6.3.x-dev conflicts with symfony/process v5.3.2.
    - symfony/console 6.3.x-dev conflicts with symfony/process v5.0.11.
    - symfony/console 6.3.x-dev conflicts with symfony/process v4.4.44.
    - symfony/console 6.3.x-dev conflicts with symfony/process v4.4.26.
    - symfony/console 6.3.x-dev conflicts with symfony/process v3.4.47.
    - symfony/console 6.3.x-dev conflicts with symfony/process v3.3.6.
    - nunomaduro/collision[v6.1.0, ..., v6.2.1] require symfony/console ^6.0.2 -> satisfiable by symfony/console[v6.0.2, ..., 6.3.x-dev].
    - Root composer.json requires nunomaduro/collision ^6.1 -> satisfiable by nunomaduro/collision[v6.1.0, ..., v6.x-dev].

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

如果您将注意力集中在下面这一行:

 - nigelcunningham/puphpeteer 2.0.0 requires nesk/rialto ^1.2.0 -> satisfiable by nesk/rialto[1.2.0, 1.2.1, 1.3.0, 1.4.0].

nigelcunningham/puphpeteer
需要依赖
nesk/rialto
,其最新版本
dev-dev
需要
symfony/process: ^3.3|^4.0|^5.0
。不幸的是,Laravel v9.0.0 (
laravel/framework
)
需要
symfony/process: ^6.0
使其不兼容。


继续前进,在您的问题中,您在

composer.json
文件
"nesk/puphpeteer": "dev-dev"
中声明了必需的依赖项。这与 Laravel v9.0.0 存在相同的不兼容问题,如上所述。

它引发了以下错误:

composer update

 - nesk/puphpeteer dev-dev requires nesk/rialto ^1.2.0 -> satisfiable by nesk/rialto[1.2.0, 1.2.1, 1.3.0, 1.4.0].
    - nesk/rialto 1.4.0 requires symfony/process ^3.3|^4.0|^5.0 -> satisfiable by symfony/process[v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev].

附录

OP(dfeva)的评论

感谢您的精彩回答!看起来这个 nesk/rialto 叉子是 更新至 symphony/process ^6.0。 github.com/zoonru/rialto/blob/zoon/composer.json。 我怎样才能先安装它,然后我应该能够安装 github.com/zoonru/puphpeteer 如果我理解正确的话。感谢您的帮助!

要实现这一点,您可以使用:

composer.json (新条目)

{
    "repositories": [
        {
            "url": "https://github.com/zoonru/rialto.git",
            "type": "git"
        },
        {
            "url": "https://github.com/zoonru/puphpeteer.git",
            "type": "git"
        }
    ],
    "require": {
        "nesk/puphpeteer": "dev-master"
    },

    "minimum-stability": "dev"
}

不幸的消息是,在撰写本文时,Version 1.4.0

依赖项的
最新git标签(zoonru/rialto
于2020年4月12日发布)
依赖于
"symfony/process": "^3.3|^4.0|^5.0"
版本.

您的评论中链接的更新的更改旨在支持新的 Symfony 组件 (

"symfony/process": "^3.3 || ^4.0 || ^5.0 || ^6.0"
) 是在稍后的日期(2022 年 8 月 16 日)进行的。遗憾的是,反映这些更改的更新的 git 标签尚未正式发布。 尚未发布。 😑

临时解决方案(谨慎使用)

如果您仍然

坚持想要安装zoonru/puphpeteer

,您可能需要分叉
https://github.com/zoonru/rialto并创建一个新的git标签反映对存储库。

步骤

    分叉
  1. zoonru/rialto 存储库。阅读分叉存储库
  2. 克隆存储库的分叉版本。阅读
  3. 克隆存储库
  4. 在您的分叉存储库版本上创建带注释的
  5. git 标签。阅读在 GitHub 存储库中创建标签
      在分叉存储库的根路径中,打开终端。运行命令:
    • git tag 1.5.0 -a
       创建一个新的 git 标签。 (在您的标签中包含说明。即:
      版本 1.5.0
    • 使用以下命令将新的 git 标签推送到远程分叉存储库:
    • git push origin --tags
      
      
  6. 您现在应该能够在远程分叉存储库上看到最新的 git 标签。即:
  7. https://github.com/steven7mwesigwa/rialto/tags
    • https://github.com/YOUR-GITHUB-USERNAME-HERE/rialto/tags
      
      
  8. 现在,在 Laravel 项目的
  9. composer.json
     文件中,使用新分叉的远程存储库版本,而不是 
    https://github.com/zoonru/rialto.git
    。即:
    https://github.com/steven7mwesigwa/rialto.git
    
    

composer.json (新条目)

{ "repositories": [ { "url": "https://github.com/steven7mwesigwa/rialto.git", "type": "git" }, { "url": "https://github.com/zoonru/puphpeteer.git", "type": "git" } ], "require": { "nesk/puphpeteer": "dev-master" }, "minimum-stability": "dev" }

您可以将 https://github.com/steven7mwesigwa/rialto.git

 替换为新分叉的远程存储库 URL。

    在 Laravel 项目的根目录下,打开终端,然后运行命令
  1. composer update
    ,这将安装 
    zoonru/puphpeteer
样本输出

A.

composer show nesk/rialto -a


PS C:\xampp\htdocs\example-app> composer show nesk/rialto -a name : nesk/rialto descrip. : Manage Node resources from PHP keywords : php, node, wrapper, communication, bridge, socket versions : 1.5.0, 1.4.0, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.2, 1.0.1, 1.0.0, 0.1.2, 0.1.1, 0.1.0, dev-zoon, dev-dev type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : source : [git] https://github.com/steven7mwesigwa/rialto.git c6ffad796941eaaf166c089f116a762f1c79d2e4 dist : [] names : nesk/rialto autoload psr-4 Nesk\Rialto\ => src/ requires php ^7.2 || ^8.0 clue/socket-raw ^1.2 psr/log ^1.0 || ^2.0 || ^3.0 symfony/process ^3.3 || ^4.0 || ^5.0 || ^6.0 requires (dev) monolog/monolog ^1.0 || ^2.0 || ^3.0 phpunit/phpunit ^8.0 || ^9.0 suggests ext-weakref Required to run all the tests
B. 

composer update


PS C:\xampp\htdocs\example-app> composer update Loading composer repositories with package information Updating dependencies Lock file operations: 4 installs, 1 update, 0 removals - Locking clue/socket-raw (v1.6.0) - Locking nesk/puphpeteer (dev-master 52bd425) - Locking nesk/rialto (1.5.0) - Downgrading psr/log (3.0.0 => 1.1.4) - Locking vierbergenlars/php-semver (v3.0.3) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 4 installs, 1 update, 0 removals - Syncing nesk/rialto (1.5.0) into cache - Syncing nesk/puphpeteer (dev-master 52bd425) into cache - Downgrading psr/log (3.0.0 => 1.1.4): Extracting archive - Installing vierbergenlars/php-semver (v3.0.3): Extracting archive - Installing clue/socket-raw (v1.6.0): Extracting archive - Installing nesk/rialto (1.5.0): Cloning c6ffad7969 from cache - Installing nesk/puphpeteer (dev-master 52bd425): Cloning 52bd42570e from cache 1 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi INFO Discovering packages. fruitcake/laravel-cors ........................................................................................ DONE laravel/sail .................................................................................................. DONE laravel/sanctum ............................................................................................... DONE laravel/tinker ................................................................................................ DONE nesbot/carbon ................................................................................................. DONE nunomaduro/collision .......................................................................................... DONE nunomaduro/termwind ........................................................................................... DONE spatie/laravel-ignition ....................................................................................... DONE 84 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan vendor:publish --tag=laravel-assets --ansi --force INFO No publishable resources for tag [laravel-assets]. No security vulnerability advisories found


希望您会记得在 Laravel 项目的 https://github.com/steven7mwesigwa/rialto.git

 文件中将您的分叉存储库 URL 替换为原始 
https://github.com/zoonru/rialto.git
 存储库 URL,即:
composer.json
,并在 
zoonru/rialto
 发布新的官方 git 后重新安装 
zoonru/puphpeteer到时候标记一下。



0
投票
不幸的是,原来的 Puppeteer 已不再维护,您现在应该依靠分支才能在最近的 Laravel 项目中使用它。

如果你正在开始一个新的 Laravel 项目,我会更好地推荐使用 Panther:

https://github.com/symfony/panther

© www.soinside.com 2019 - 2024. All rights reserved.