缺少composer/zend命令:development-enable


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. 

有人能复制/修复这个问题吗?

我通常认为这是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输入/输出。
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"

p

在编写本文时,骨架应用程序需要PHP "^5.6 || ^7.0"。因此,如果您运行的是较低版本的编译器不会安装该副本。基于它的教程可能不能像预期的那样工作。

我注意到两件事:当您第一次初始化骨架应用程序时,根据您的设置,开发模式默认是启用的。

如果你想运行

composer development-enable

或任何其他类似的命令,您必须在您的path/to/installpath/to/yourapp目录中才能使其工作!这是包含本地编写器安装的文件夹。

如果在父目录中,该命令将不起作用。

在我的apigility应用程序上尝试使用命令composer development-enable启用开发模式时,我也遇到了类似的问题。我得到错误:

zf-development-mode不被识别为内部或外部命令。

在适应性网站上有一个关于开发模式模块的页面: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似乎工作得很好,在我的情况下返回消息'已经在开发模式'。