我正在尝试安装jenssegers Laravel-MongoDB软件包。 (https://github.com/jenssegers/Laravel-MongoDB)
当我尝试composer update
时,我收到以下错误:
"error":{"type:"ReflectionException","message":"Classs db does not exist","file":"C:\\wamp\\www\\projectname\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php","line":308}} Script php artisan clear-compiled handling the post-update-cmd event returned with an error
我的composer.json
文件如下所示:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.0.*",
"jenssegers/mongodb": "*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
有任何建议如何解决这个问题?
答案 0 :(得分:0)
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Jenssegers\Mongodb\MongodbServiceProvider',
答案 1 :(得分:0)
您是否在代码中使用db而不是DB?使用大写DB。另外,检查是否需要使用\ DB而不是DB,这可能是由于尝试在另一个非全局命名空间中使用数据库外观。
答案 2 :(得分:0)
您只需执行以下命令即可成功安装。它对我有用。
要安装MongoDB,请按照
进行操作- > sudo -s - > apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo' deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
- > apt-get update - > apt-get -y install mongodb-org
- > grep -q" extension = mongo.so" /etc/php5/apache2/php.ini || echo" extension = mongo.so" >> /etc/php5/apache2/php.ini
- > grep -q" extension = mongo.so" /etc/php5/cli/php.ini || echo" extension = mongo.so" >> /etc/php5/cli/php.ini& amp ;& amp; pecl install mongo
- > echo" extension = mongo.so" >> /etc/php5/cli/php.ini
- > service apache2 restart
然后移动到laravel目录并运行以下命令
- > composer需要jenssegers / mongodb
然后按this页。
答案 3 :(得分:0)
您必须安装MongoDB您可以在http://docs.mongodb.org/manual/installation
找到安装说明然后安装MongoDB PHP驱动程序。您可以在http://php.net/manual/en/mongo.installation.php
找到安装说明