我尝试添加
"scripts": {
"sym": "php bin/console",
}
在composer.json中,然后生成composer install
。
但是,如果我运行sym make:migration
而不是php bin/console make:migration
,则会出现错误:
Command 'sym' not found, did you mean:
command 'sem' from deb parallel
command 'sm' from deb sm
command 'vym' from deb vym
command 'sys' from deb openafs-client
command 'sum' from deb coreutils
command 'syf' from deb alliance
command 'spm' from deb salt-common
command 'srm' from deb secure-delete
command 'scm' from deb scm
Try: sudo apt install <deb name>
我做错了吗?
答案 0 :(得分:4)
您必须在命令前加上composer
。因此composer sym make:migration
将通过Composer来完成这项工作。
要使命令正常工作,您不需要Composer。您必须创建一个可执行文件。在项目根目录中创建一个名为sym
的文件:
#!/bin/sh
php bin/console $1
使文件可执行chmod +x sym
。
./sym make:migration
将起作用。