I made this mistake when:
Laravel version 5.8, need to introduce tcpdf, in the run
composer require tecnickcom/tcpdf
I found two answers, both of which were caused by the composer upgrade, but I don’t remember that I was promoted. I learned from one of the methods and successfully introduced the tcpdf extension. Now I integrate the two methods:
1. Change the source code
Positioning error:
vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php
122 line prompt does not have the key name, according to the code prompt to find
/vendor/laravel/framework/src/Illuminate/Support/Collection.php
Of Mapwithkeys method. Add a compatible method to cover the original method
public function mapWithKeys(callable $callback)
{
$result = [];
$item = $this->items;
if(isset($item['packages'])){
$item = $item['packages'];
}
foreach ($item as $key => $value) {
$assoc = $callback($value, $key);
foreach ($assoc as $mapKey => $mapValue) {
$result[$mapKey] = $mapValue;
}
}
return new static($result);
}
2. Composer level
# composer Downgrade (if you can't downgrade, you can try to run with root privileges)
composer self-update --1
# Re-install and It's Done!!!
composer install
The above two methods are effective
Read More:
- Lack of files in composer installation [How to Solve]
- composer Error: The requested PHP extension ext-bcmath * is missing from your system. Install or enable
- composer Error while processing content unencoding: Unknown failure within decompression softwar
- PHP solves the problem that composer exceeds the memory size Allowed memory size
- composer Failed to decode response: zlib_decode(): data error
- How to Hide index.php
- [PHP] Solve PHP Call to undefined function ldap_connect()
- [WordPress Error] Fatal error undefined function is_network_admin()
- PHP encryption 3DES error Call to undefined function: mcrypt_module_open() solution
- [Solved] WordPress Upgrade PHP 5.6 to 7.x Fatal error: Uncaught Error: Call to undefined function mysql_connect()
- Error during PHP installation and configuration error: off_t undefined; check your library configuration
- Using $this when not in object context in (How to Fix)
- PHP error in Windows: class’ mysqli ‘not found
- [Solved] tp6.0 open_basedir Error: Warning: require(): open_basedir restriction in effect.
- PHP php-config is not installed error in ubuntu 16 [How to Solve]
- PHP Error Object of class mysqli could not be converted to string in
- [PHP]json_encode Chinese JSON_UNESCAPED_UNICODE returns null in php5.3
- Fatal error: Function name must be a string in
- Syntax error: typeerror: about installing sass in vue3 this.getOptions is not a function
- [PHP] Array to string conversion error when sending data in post