当前位置: 首页>>技术问答>>正文


Magento 2 – 部署magento-sample-data时无法安装的软件包集

webfans 技术问答 , , , 去评论

问题描述

安装Magento 2后,我跟着this Magento DevDocs tutorial安装了样本数据。

但执行完最后一个命令./bin/magento sampledata:deploy后,我收到以下错误:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - The requested package magento/module-offline-shipping-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 2
    - The requested package magento/module-theme-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 3
    - The requested package magento/module-sales-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 4
    - The requested package magento/module-msrp-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 5
    - The requested package magento/module-sales-rule-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 6
    - The requested package magento/module-configurable-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 7
    - The requested package magento/module-product-links-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 8
    - The requested package magento/module-catalog-rule-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 9
    - The requested package magento/module-grouped-product-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 10
    - The requested package magento/module-tax-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 11
    - The requested package magento/module-catalog-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 12
    - The requested package magento/module-downloadable-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 13
    - The requested package magento/module-cms-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 14
    - The requested package magento/module-bundle-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 15
    - The requested package magento/module-swatches-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 16
    - The requested package magento/module-widget-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 17
    - The requested package magento/module-review-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 18
    - The requested package magento/module-customer-sample-data could not be found in any version, there may be a typo in the package name.
  Problem 19
    - The requested package magento/module-wishlist-sample-data could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

一直无法找到解决方案,说实话,我对作曲家的了解严重缺乏。欢迎任何帮助。

最佳解决办法

我也一直在努力安装示例数据。看来这里的东西已经破了(2015年10月),instructions in the devdocs对我来说也不起作用。我遇到了相同的作曲家问题,magento sampledata:install甚至没有。

相反,我一直在遵循sample data’s readme file上的“From GitHub Repository”说明:

只需将repo克隆到某处(可以在项目文件夹之外,因为该工具正在处理各个模块的符号化):

git clone https://github.com/magento/magento2-sample-data.git ~/sample-data

然后运行”installer”脚本:

php -f ~/sample-data/dev/tools/build-sample-data.php -- --ce-source="$PATH_TO_YOUR_MAGENTO2_PROJECTROOT"

之后运行更新脚本:

cd $PATH_TO_YOUR_MAGENTO2_PROJECTROOT
bin/magento setup:upgrade

你应该看到安装的样本数据(需要一段时间……):

[...]
Module 'Magento_DownloadableSampleData':
Installing data..
Module 'Magento_ThemeSampleData':
Installing data..
Module 'Magento_OfflineShippingSampleData':
Installing data..
Module 'Magento_ConfigurableSampleData':
Installing data..
Module 'Magento_BundleSampleData':
Installing data..
Module 'Magento_ProductLinksSampleData':
Installing data..
Module 'Magento_ReviewSampleData':
Installing data..
[...]

不要忘记清除缓存并修复权限,您应该在后端和前端看到所有示例数据…

次佳解决办法

有同样的问题。修复了转到根目录并使用以下命令指定composer的存储库(使用https以避免编写器警告):

composer config repositories.magento composer https://repo.magento.com

之后

cd bin
php magento sampledata:deploy

按预期工作

第三种解决办法

最近的代码更改使得可以使用Magento 2 CE GitHub开发分支安装样本数据,前提是您克隆了Magento 2和样本数据存储库。

这种安装样本数据的方法将通过GA使用命令行选项和Composer选项来扩充;但是,目前,AFAIK,这是使用develop分支安装样本数据的唯一方法。

简单来说:

  1. 克隆Magento 2 CE GitHub存储库(默认开发分支)。

  2. 从项目根目录运行’composer install’。

  3. 克隆Magento 2 sample data repository(默认开发分支)。

  4. 链接示例数据存储库。 (php -f sample-data-repo /dev /tools /build-sample-data.php – –ce-source = “your-Magento-CE-install-dir”)

  5. 在示例数据存储库中设置权限和所有权。

  6. 使用CLI或安装向导安装Magento。 (安装向导不再具有“安装示例数据”复选框。)

请注意,如果运行安装向导,则可能会看到完成约90%的异常。如果是这样,请再次设置文件系统权限和所有权(很可能是root用户)。

详细信息:http://devdocs.magento.com/guides/v2.0/install-gde/install/web/install-web-sample-data.html

第四种办法

在第一部分中,在许可之前添加"minimum-stability": "beta"

参考资料

本文由朵颐IT整理自网络, 文章地址: https://duoyit.com/article/2723.html,转载请务必附带本地址声明。