【问题标题】:php bin/magento setup:di:compile Errorsphp bin/magento setup:di:compile 错误
【发布时间】:2021-07-29 13:48:17
【问题描述】:

当我在 cmd 上运行 php bin/magento setup:di:compile 时会发生此错误:

编译已开始。 插件列表生成... 8/9 [=========================>---] 88% 10 分钟 392.0 MiB 在 ErrorHandler.php 第 61 行: 警告:file_put_contents(C:/xampp/htdocs/magento/generated/metadata/primary|global|plugin-list.php):无法打开流:C:\xampp 中没有这样的文件或目录 \htdocs\magento\vendor\magento\framework\Interception\PluginListGenerator.php 在第 415 行 设置:di:编译

然后我在互联网上看到了解决方案,我发现如果我更换这个 $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;
$cacheId = implode(‘-’, $this->scopePriorityScheme) . “-” . $this->cacheId;

然后此错误将解决,但会产生一个新错误:

不推荐使用的功能:包含两个“.”的无括号表达式的行为并且 '+'/'-' 将在 PHP 8 中更改:'+'/'-' 将在第 159 行的 C:\xampp\htdocs\magento\vendor\magento\framework\Interception\PluginListGenerator.php 中获得更高的优先级

当我放弃所有以前的更改然后再次发生第一个错误时,此错误就会解决

【问题讨论】:

  • 所以,修复第二个错误,不要恢复更改。
  • 第二个错误的解决方法是这个 chages $cacheId = implode('-', $this->scopePriorityScheme) 。 “-”。 $this->cacheId;到 $cacheId = implode('|', $this->scopePriorityScheme) 。 “|” . $this->cacheId;我改变它以解决第一个错误。
  • 不,第二个错误的解决方案不是恢复更改,而是修复您收到的“不推荐使用的功能”警告 - 这很自我解释。

标签: php magento installation


【解决方案1】:
$cacheId = implode(‘-’, $this->scopePriorityScheme) . “-” . $this->cacheId;

我从网站复制这一行,当我复制它时,'' 自动更改为 '' 并且 "" 更改为 "" 发生了错误。 使用这个:

$cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;

谢谢

【讨论】:

    【解决方案2】:

    换行

    $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;
    

    与以下一个:

    $cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
    

    【讨论】:

    • 您好,感谢您的回答。如果您能解释这个答案为什么以及如何解决 OP 的问题,我相信这将对每个人都有很大帮助!
    猜你喜欢
    • 2021-08-30
    • 1970-01-01
    • 2019-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-01
    相关资源
    最近更新 更多