没有不值得去解决的问题,也没有不值得去学习的技术!

How to Fix Class ‘trntv\aceeditor\AceEditor’ Not Found in yii2-starter-kit

打开后端 - 内容 - 文本组件 - 创建文本块,报错:Class 'trntv\aceeditor\AceEditor' not found

1. Open the backend, navigate to Content – Text Widgets – Create Text Block, and an error occurs: Class ‘trntv\aceeditor\AceEditor’ not found, as shown in Figure 1.

Open the backend, navigate to Content - Text Widgets - Create Text Block, and an error occurs: Class 'trntv\aceeditor\AceEditor' not found
Open the backend, navigate to Content – Text Widgets – Create Text Block, and an error occurs: Class ‘trntv\aceeditor\AceEditor’ not found

2. Edit yii2-starter-kit\vendor\trntv\yii2-file-kit\composer.json, as shown in Figure 2.

“autoload”: {
“psr-4”: { “trntv\\filekit\\”: “” }
},

Change it to:

“autoload”: {
“psr-4”: { “trntv\\filekit\\”: “src/” }
},

Note: Redefine the mapping from the namespace to the directory; the directory should be set to src/.

Edit yii2-starter-kit\vendor\trntv\yii2-file-kit\composer.json
Edit yii2-starter-kit\vendor\trntv\yii2-file-kit\composer.json

3. Run the composer update command again to generate the vendor/autoload.php file, as shown in Figure 3.

Run the composer update command again to generate the vendor/autoload.php file
Run the composer update command again to generate the vendor/autoload.php file

4. The error still occurs, as shown in Figure 4.

The error still occurs
The error still occurs

5. Check yii2-starter-kit\vendor\composer\autoload_psr4.php, as shown in Figure 5.

‘trntv\\aceeditor\\’ => array($vendorDir . ‘/trntv/yii2-aceeditor’),

The directory mapping has not changed.

Check yii2-starter-kit\vendor\composer\autoload_psr4.php
Check yii2-starter-kit\vendor\composer\autoload_psr4.php

6. Edit yii2-starter-kit\vendor\composer\autoload_psr4.php and yii2-starter-kit\vendor\composer\autoload_static.php, as shown in Figures 6 and 7.

Edit yii2-starter-kit\vendor\composer\autoload_psr4.php
Edit yii2-starter-kit\vendor\composer\autoload_psr4.php
Edit yii2-starter-kit\vendor\composer\autoload_static.php
Edit yii2-starter-kit\vendor\composer\autoload_static.php

7. It now runs normally, as shown in Figure 8.

It now runs normally
It now runs normally

8. Submit this error as an issue to GitHub, as shown in Figure 9.

Submit this error as an issue to GitHub
Submit this error as an issue to GitHub

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系