我正在尝试使用composer install
来安装WordPress核心和一些插件,使用自定义目录结构。这似乎不是未来的最佳实践,但我需要在本地按原样安装它,以便在服务器上测试更改它。
目前,composer install
给了我一个错误。
InvalidArgumentException]
很抱歉,在配置的webroot中只能安装一个程序包。
我不认为这是在试图在webroot中安装多个程序包。我以为这只是在webroot中安装WordPress核心。
这是我的composer.json:
{
"name": "mrengy/emandminbeantown",
"description": "Em and M in Beantown Blog",
"require": {
"wordpress/wordpress": "5.8.*",
"wpackagist-plugin/akismet": "*",
"wpackagist-plugin/broken-link-checker": "*",
"wpackagist-plugin/degradable-html5-audio-and-video": "*",
"wpackagist-plugin/display-php-version": "*",
"wpackagist-plugin/enable-media-replace": "*",
"wpackagist-plugin/fitvids-for-wordpress": "*",
"wpackagist-plugin/fix-image-rotation": "*",
"wpackagist-plugin/jetpack": "*",
"wpackagist-plugin/mailchimp-for-wp": "*",
"wpackagist-plugin/media-element-html5-video-and-audio-player": "*",
"wpackagist-plugin/postie": "*",
"wpackagist-plugin/regenerate-thumbnails": "*",
"wpackagist-plugin/simple-top-commenters": "*",
"wpackagist-plugin/video-embed-thumbnail-generator": "*",
"wpackagist-plugin/w3-total-cache": "*",
"wpackagist-plugin/classic-editor": "*"
},
"repositories":[
{
"type":"composer",
"url":"https://wpackagist.org"
},
{
"type" : "package",
"package" : {
"name" : "wordpress/wordpress",
"type" : "webroot",
"version" : "5.8",
"dist" : {
"url" : "https://github.com/WordPress/WordPress/archive/5.8.zip",
"type" : "zip"
},
"source" : {
"url" : "https://github.com/WordPress/WordPress",
"type" : "git",
"reference" : "5.8"
},
"require" : {
"fancyguy/webroot-installer" : "1.0.0"
}
}
}
],
"autoload": {
"psr-0": {
"Acme": "src/"
}
},
"config" : {
"vendor-dir": "content/vendor",
"allow-plugins": {
"johnpbloch/wordpress-core-installer": true,
"composer/installers": true,
"fancyguy/webroot-installer": true
}
},
"extra" : {
"installer-paths": {
"content/plugins/{$name}/": ["type:wordpress-plugin"],
"content/themes/{$name}/": ["type:wordpress-theme"]
},
"webroot-dir" : "wp",
"webroot-package" : "wordpress",
"wordpress-install-dir": "wp"
}
}
奇怪的是,我能够在另一个repo中的一个非常相似的composer.json上运行composer install
而没有错误。
{
"name": "mrengy/mike-eng.com",
"description": "personal website",
"require": {
"johnpbloch/wordpress": "5.8.*",
"wpackagist-plugin/akismet": "*",
"wpackagist-plugin/broken-link-checker": "*",
"wpackagist-plugin/email-address-encoder": "*",
"wpackagist-plugin/enable-media-replace": "*",
"wpackagist-plugin/image-rotation-fixer": "*",
"wpackagist-plugin/jetpack": "*",
"wpackagist-plugin/kimili-flash-embed": "*",
"wpackagist-plugin/manual-image-crop": "*",
"wpackagist-plugin/show-current-template": "*",
"wpackagist-plugin/syntax-highlighter": "*",
"wpackagist-plugin/wpaudio-mp3-player": "*",
"wpackagist-plugin/wp-retina-2x": "*"
},
"require-dev": {
"wpackagist-plugin/debug-bar": "*",
"wpackagist-plugin/debug-bar-console": "*",
"wpackagist-plugin/wordpress-importer": "*"
},
"repositories":[
{
"type":"composer",
"url":"https://wpackagist.org"
},
{
"type" : "package",
"package" : {
"name" : "wordpress",
"type" : "webroot",
"version" : "5.8",
"dist" : {
"url" : "https://github.com/WordPress/WordPress/archive/5.7.zip",
"type" : "zip"
},
"source" : {
"url" : "https://github.com/WordPress/WordPress",
"type" : "git",
"reference" : "5.8"
},
"require" : {
"fancyguy/webroot-installer" : "1.0.0"
}
}
}
],
"autoload": {
"psr-0": {
"Acme": "src/"
}
},
"config" : {
"vendor-dir": "content/vendor"
},
"extra" : {
"installer-paths": {
"content/plugins/{$name}/": ["type:wordpress-plugin"],
"content/themes/{$name}/": ["type:wordpress-theme"]
},
"webroot-dir" : "wp",
"webroot-package" : "wordpress",
"wordpress-install-dir": "wp",
"dropin-paths": {
"content/languages/": ["vendor:koodimonni-language"],
"content/languages/plugins/": ["vendor:koodimonni-plugin-language"],
"content/languages/themes/": ["vendor:koodimonni-theme-language"]
}
}
}
我在Composer v 1.10.26(全终端输出(和Composer v 2.2.7(全终端输入(上得到了相同的错误
如何成功修复此问题和composer install
?
您混淆了两种不同的WordPress安装方法——fancyguy/webroot-installer
和johnpbloch/wordpress
。选择其中一个,然后使用rm -rf vendor && composer update -v
进行干净安装。