我通过比特桶克隆了一个回购协议,这是一个Magento 2项目。
以下是一些细节:
- 我在Windows环境中同时使用
ddev
和docker
。 - 我使用过Ubuntu 18.04版
php 7.4.1版
*** composer v2*
现在,我可以运行ddev start
,它会返回三个 * URL * 来访问该网站。
但是当我尝试访问他们每一个人的时候,出现了这样的错误:
Warning: require(/var/www/html/vendor/composer/../../app/etc/stores.php): failed to open stream: No such file or directory in /var/www/html/vendor/composer/autoload_real.php on line 82
Fatal error: require(): Failed opening required '/var/www/html/vendor/composer/../../app/etc/stores.php' (include_path='/var/www/html/vendor/magento/zendframework1/library:.:/usr/share/php:/var/www/html/vendor/deployer/recipes') in /var/www/html/vendor/composer/autoload_real.php on line 82
字符串
因此,我尝试从shell(ddev ssh
)和外部运行composer install
,但没有成功。
我尝试删除vendor
文件夹并重新运行composer install
,但没有成功。
此外,每次运行composer install
时,它都无法设置CodeSniffer,如下所示:
Generating autoload files
137 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Failed to set PHP CodeSniffer installed_paths Config
型
正如我所理解的,问题出在 vendor/composer/ 文件夹中的这个autoload_真实的.php文件中:
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit95a846f5f47c0550ba8f462ebc5cc61f
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit95a846f5f47c0550ba8f462ebc5cc61f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit95a846f5f47c0550ba8f462ebc5cc61f', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
$includePaths[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $includePaths));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit95a846f5f47c0550ba8f462ebc5cc61f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit95a846f5f47c0550ba8f462ebc5cc61f::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire95a846f5f47c0550ba8f462ebc5cc61f($fileIdentifier, $file);
}
return $loader;
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequire95a846f5f47c0550ba8f462ebc5cc61f($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}
型
我试过的最后一个命令是composer dump-autoload
,但结果是一样的。
因此,我需要消除网页中的错误,以便能够正确地看到它,并能够以某种方式设置CodeSniffer。
为什么会出现此错误?如何解决此错误?
如果有人能帮上忙,那就太棒了,谢谢你们。
另外,我已经尝试在全局范围内安装CodeSniffer,但它没有解决问题。
1条答案
按热度按时间hc2pp10m1#
从
html
目录运行vendor/bin/phpcs --config-show
如果
installed_paths
未列出或不正确,请运行以下命令:字符串