gpt4 book ai didi

javascript - 为什么我想运行 Coffeescript cake 命令时却运行了 CakePHP 的 cake 命令?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:23:28 26 4
gpt4 key购买 nike

我第一次尝试在 Ubuntu 12.04 上运行 givenwhenthen Node 模块,我已经按照他们网站上“Running Stories”标题下列出的设置说明进行操作 here.

我已经在 /~/node_modules/givenwhenthen/examples/ 中将任务 test:acceptance 添加到我的 cakefile 中,如下所示:

task 'test:acceptance', 'Runs the acceptance tests', (options = {}) ->
givenwhenthen.runner.runStories(options)

当我从同一目录运行 cake 时,我得到以下列出的路径:

CakePHP v2.2.2 Console
App: examples
Path: /home/kyoob/node_modules/givenwhenthen/examples/
Root: /home/kyoob/node_modules/givnwhenthen
Core: /usr/share/php/cakephp/lib

我在“可用外壳”下没有看到 test:acceptance,也根本没有看到“可用任务”部分。应该在此处列出吗?

当我从这个目录运行 cake test:acceptance 时,我得到的消息是:

Shell class Test:acceptanceShell could not be found.
#0 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(191): ShellDispatcher->_getShell('test:acceptance')
#1 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
#2 /usr/share/php/cakephp/lib/Cake/Console/cake.php(43): ShellDispatcher::run(Array)
#3 {main}

我已经尝试使用和不使用 sudo 来达到相同的效果。我是编译 CoffeeScript 文件领域的新手,所以我担心这是我的菜鸟错误。我是不是想从错误的目录编译?我错过了一些明显的东西吗?

最佳答案

这些不是您要找的蛋糕

When I run cake from that same directory I get the following paths listed:
CakePHP v2.2.2 Console

这意味着您正在运行 CakePHP's cake cli .

When I run cake test:acceptance ...

此语法意味着您正在尝试运行coffeescript cake命令(这两个命令的语法不一样)。您可以通过运行来验证您正在调用哪个命令:

which cake

修正你的路径

猜测 /usr/share/php/cakephp/lib/Cake/Console 在您的路径中,这意味着当您键入没有路径的 cake它将找到 CakePHP 的蛋糕脚本。最好更正您的 $PATH 并删除 CakePHP,从而避免歧义。

运行coffeescript的cake

当您想运行 coffeescript cake 命令时 - 使用 coffeescript cake 命令:

$ /usr/local/bin/cake test:acceptance

或者,一旦您的 $PATH 正确并且由于 coffeescript 默认在系统范围内安装它,您可以在没有路径的情况下使用它:

$ cake test:acceptance

运行 CakePHP 的蛋糕

如果您想运行 CakePHP 的 cli(在您不这样做的问题中)- 在 app 文件夹中执行此操作,并使用相对路径:

$ cd /my/app
$ Console/cake

此命令仅在您位于应用程序文件夹中时才有效,它不依赖于您的 $PATH

如果有疑问,请使用可执行文件的绝对路径,但如果您使用的是 CakePHP 和 coffeescript,请确认有两个名为 cake 的脚本,并且它们完全不同且不兼容 , 因此将可接受的论据从一个传递到另一个将根本行不通。

关于javascript - 为什么我想运行 Coffeescript cake 命令时却运行了 CakePHP 的 cake 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17366180/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com