我正在使用我正在研究的Symfony网站遇到一个相当奇怪的问题。出于某种原因,当我写composer update
或composer install
时,我得到以下结果:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "Z:\path\to\project\app/config\config.yml" from "Z:\path\to\project\app/config/config_dev.yml". (There is no ext
ension able to load the configuration for "imports" (in Z:\path\to\project\app/config\config.yml). Loo
ked for namespace "imports", found "framework", "security", "twig", "mon
olog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "com
mon_common", "common_security", "dashboard", "receipts", "hr",
"service", "users", "partners", "storage", "web_profiler",
"sensio_distribution")
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
There is no extension able to load the configuration for "imports" (in Z:\path\to\project\app/config\config.yml). Looked for namespace "imports", found "framework", "security
", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framewo
rk_extra", "common_common", "common_security", "dashboard", "receip
ts", "hr", "service", "users", "partners", "storage", "
web_profiler", "sensio_distribution"
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command.
config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
translator: { fallback: "%locale%" }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
sitename: "%sitename%"
session: {}
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ CommonSecurityBundle ]
#java: /usr/bin/java
assets:
base_css:
inputs:
- '%kernel.root_dir%/Resources/public/css/admin.css'
- '%kernel.root_dir%/Resources/public/css/superfish/superfish.css'
timer_js:
inputs:
- '%kernel.root_dir%/Resources/public/js/time.js'
filters:
cssrewrite: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
config_dev.yml
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
bubble: false
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
assetic:
use_controller: true
#swiftmailer:
# delivery_address: me@example.com
parameters.yml
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_pgsql
database_host: 127.0.0.1
database_port: 5432
database_name: db_name
database_user: db_user
database_password: db_pass
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: asdBHwmI1hsjKjanJK2WD@wdnak
security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_STORAGE_WRITE: ROLE_STORAGE_READ
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
main_provider:
chain:
providers: [ in_memory ]
in_memory:
memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: password, roles: [ 'ROLE_SUPER_ADMIN' ] }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/login$
security: false
secured_area:
pattern: ^/
logout: true
anonymous: false
logout:
path: logout
target: /
invalidate_session: false
simple_form:
authenticator: authentication_token
check_path: login_check
login_path: login
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, roles: ROLE_USER }
我不知道它为什么说它不能import
imports
部分中的文件 - 它们存在且可写/可读。有人能否了解这里发生的事情?
Symfony版本:2.4.2
作曲家版本:70a20ebcc19f1ea8ab0954a4fbdce208b30085e7 2014-03-12 16:07:58
答案 0 :(得分:2)
有些时候,在文件开头插入额外字节的文件会发生疯狂的事情。您可以尝试手动重新创建包含内容的文件。复制粘贴我的包括那些字节。