缺少 composer/zend 命令:开发启用
Missing composer/zend command: development-enable
当我按照 Zend 主要教程的说明通过 composer create-project -n -sdev zendframework/skeleton-application
安装 Zend 时,我得到了一个看起来运行良好的骨架应用程序。
但是,当我按照本教程的建议使用 composer development-enable
时,我收到以下消息:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "development-enable" is not defined.
有人能duplicate/fix这个问题吗?
我通常认为这是 bash $PATH 值的问题,但 composer
命令本身运行得很好,所以我认为这可能是其他一些特定于此子命令 -- 例如,某处缺少依赖项。
这是我尝试遵循的教程的相关部分:
https://docs.zendframework.com/tutorials/getting-started/skeleton-application/
(如果它有助于复制:我的开发服务器上的 CLI PHP 版本是 5.4.43。出于不想让您厌烦的原因,我无法更新此 CLI PHP 到较新的版本;Apache 在我的机器上使用的主要版本是 5.6。)
编辑 1:使用 composer create-project -s dev zendframework/skeleton-application
(如链接教程中指定)重新运行我的安装仍然会导致相同的问题。
编辑 2:这是我的 shell input/output。
patrick [~/www/berlin-data]# composer create-project -n -sdev zendframework/skeleton-application
Installing zendframework/skeleton-application (2.3.3)
- Installing zendframework/skeleton-application (2.3.3)
Loading from cache
Created project in /home1/patrick/public_html/berlin-data/skeleton-application
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing zendframework/zendxml (1.0.2)
Loading from cache
- Installing zendframework/zendframework (2.3.3)
Loading from cache
zendframework/zendframework suggests installing doctrine/annotations (Doctrine Annotations >=1.0 for annotation features)
zendframework/zendframework suggests installing ircmaxell/random-lib (Fallback random byte generator for Zend\Math\Rand if OpenSSL/Mcrypt extensions are unavailable)
zendframework/zendframework suggests installing ocramius/proxy-manager (ProxyManager 0.5.* to handle lazy initialization of services)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf for creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recaptcha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\Form)
Writing lock file
Generating autoload files
patrick [~/www/berlin-data]# cd skeleton-application/
patrick [~/www/berlin-data/skeleton-application]# composer development-enable
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "development-enable" is not defined.
当你 运行 命令
composer create-project -n -sdev zendframework/skeleton-application
这将在您当前的目录中创建一个名为 skeleton-application
的目录,在此目录中您需要 运行 命令:
composer development-enable
如果这仍然不起作用,则说明安装过程出了问题。
第一个命令应该给出如下内容:
$ composer create-project -n -sdev zendframework/skeleton-application
Installing zendframework/skeleton-application (dev-master 941da45b407e4f09e264f0 00fb537928badb96ed)
- Installing zendframework/skeleton-application (dev-master master)
Cloning master from cache
Created project in C:\Users\<UserName>\Documents\skeleton-application
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing zendframework/zend-component-installer (0.3.0)
Downloading: 100%
- Installing zendframework/zend-stdlib (3.0.1)
Downloading: 100%
...
注意这一行Created project in C:\Users\<UserName>\Documents\skeleton-application
这就是您需要进入的目录以执行 运行 命令:
cd C:\Users\<UserName>\Documents\skeleton-application
composer development-enable
如果还是不行,请尝试指定下载版本:
composer create-project -n "zendframework/skeleton-application":"dev-master"
PS
在撰写本文时,骨架应用程序需要 PHP "^5.6 || ^7.0"
。因此,如果您 运行 正在使用较低版本的作曲家,则不会安装该副本。并且基于它的教程可能无法按预期工作。
我注意到两件事:当您第一次初始化骨架应用程序时,根据您的设置,默认情况下会启用开发模式。
如果你想运行
composer development-enable
或任何其他类似命令,您必须在 path/to/install
或 path/to/yourapp
目录中才能运行!这是包含本地作曲家安装的文件夹。如果您在任何父目录中,该命令将不起作用。
尝试在我的 apigility 应用程序上使用命令 composer development-enable
启用开发模式时,我也遇到了类似的问题。我收到错误:
zf-development-mode 未被识别为内部或外部命令。
apigility 网站上有一个关于开发模式模块的页面:
https://apigility.org/documentation/modules/zf-development-mode
我按照说明从 composer 安装模块发现:
$ composer require zfcampus/zf-development-mode
然后复制开发配置文件:
$ cp vendor/zfcampus/zf-development-mode/development.config.php.dist config/
现在使用 composer development-enable
似乎工作正常,在我的例子中返回消息 'Already in development mode'。
当我按照 Zend 主要教程的说明通过 composer create-project -n -sdev zendframework/skeleton-application
安装 Zend 时,我得到了一个看起来运行良好的骨架应用程序。
但是,当我按照本教程的建议使用 composer development-enable
时,我收到以下消息:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "development-enable" is not defined.
有人能duplicate/fix这个问题吗?
我通常认为这是 bash $PATH 值的问题,但 composer
命令本身运行得很好,所以我认为这可能是其他一些特定于此子命令 -- 例如,某处缺少依赖项。
这是我尝试遵循的教程的相关部分:
https://docs.zendframework.com/tutorials/getting-started/skeleton-application/
(如果它有助于复制:我的开发服务器上的 CLI PHP 版本是 5.4.43。出于不想让您厌烦的原因,我无法更新此 CLI PHP 到较新的版本;Apache 在我的机器上使用的主要版本是 5.6。)
编辑 1:使用 composer create-project -s dev zendframework/skeleton-application
(如链接教程中指定)重新运行我的安装仍然会导致相同的问题。
编辑 2:这是我的 shell input/output。
patrick [~/www/berlin-data]# composer create-project -n -sdev zendframework/skeleton-application
Installing zendframework/skeleton-application (2.3.3)
- Installing zendframework/skeleton-application (2.3.3)
Loading from cache
Created project in /home1/patrick/public_html/berlin-data/skeleton-application
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing zendframework/zendxml (1.0.2)
Loading from cache
- Installing zendframework/zendframework (2.3.3)
Loading from cache
zendframework/zendframework suggests installing doctrine/annotations (Doctrine Annotations >=1.0 for annotation features)
zendframework/zendframework suggests installing ircmaxell/random-lib (Fallback random byte generator for Zend\Math\Rand if OpenSSL/Mcrypt extensions are unavailable)
zendframework/zendframework suggests installing ocramius/proxy-manager (ProxyManager 0.5.* to handle lazy initialization of services)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf for creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recaptcha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\Form)
Writing lock file
Generating autoload files
patrick [~/www/berlin-data]# cd skeleton-application/
patrick [~/www/berlin-data/skeleton-application]# composer development-enable
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "development-enable" is not defined.
当你 运行 命令
composer create-project -n -sdev zendframework/skeleton-application
这将在您当前的目录中创建一个名为 skeleton-application
的目录,在此目录中您需要 运行 命令:
composer development-enable
如果这仍然不起作用,则说明安装过程出了问题。
第一个命令应该给出如下内容:
$ composer create-project -n -sdev zendframework/skeleton-application
Installing zendframework/skeleton-application (dev-master 941da45b407e4f09e264f0 00fb537928badb96ed)
- Installing zendframework/skeleton-application (dev-master master)
Cloning master from cache
Created project in C:\Users\<UserName>\Documents\skeleton-application
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing zendframework/zend-component-installer (0.3.0)
Downloading: 100%
- Installing zendframework/zend-stdlib (3.0.1)
Downloading: 100%
...
注意这一行Created project in C:\Users\<UserName>\Documents\skeleton-application
这就是您需要进入的目录以执行 运行 命令:
cd C:\Users\<UserName>\Documents\skeleton-application
composer development-enable
如果还是不行,请尝试指定下载版本:
composer create-project -n "zendframework/skeleton-application":"dev-master"
PS
在撰写本文时,骨架应用程序需要 PHP "^5.6 || ^7.0"
。因此,如果您 运行 正在使用较低版本的作曲家,则不会安装该副本。并且基于它的教程可能无法按预期工作。
我注意到两件事:当您第一次初始化骨架应用程序时,根据您的设置,默认情况下会启用开发模式。
如果你想运行
composer development-enable
或任何其他类似命令,您必须在 path/to/install
或 path/to/yourapp
目录中才能运行!这是包含本地作曲家安装的文件夹。如果您在任何父目录中,该命令将不起作用。
尝试在我的 apigility 应用程序上使用命令 composer development-enable
启用开发模式时,我也遇到了类似的问题。我收到错误:
zf-development-mode 未被识别为内部或外部命令。
apigility 网站上有一个关于开发模式模块的页面: https://apigility.org/documentation/modules/zf-development-mode
我按照说明从 composer 安装模块发现:
$ composer require zfcampus/zf-development-mode
然后复制开发配置文件:
$ cp vendor/zfcampus/zf-development-mode/development.config.php.dist config/
现在使用 composer development-enable
似乎工作正常,在我的例子中返回消息 'Already in development mode'。