使用记录的 cro 命令行工具时遇到问题

Trouble using the cro command-line tool as documented

我在 Windows7 上 运行ning Rakudo Star 2019.03.1,Cro 是由 zef 安装的。在 Getting Started section on the Cro website 之后,以下应该有效:

The cro stub command generates stub services for you, to get started more quickly and with better defaults. Here we use it to create a simple HTTP service, with ID hello and in the hello directory:

cro stub http hello hello

...这确实有效,它为项目生成了很多文件,包括 .cro.yml 文件,我认为它是服务的中心描述文件。但是,如果我尝试遵循文档和 运行 cro run(我假设来自 hello 目录):

The cro run command will start your service (and automatically restart the service if you change a file):

cro run

...服务未启动但 cro 错误:

A react block:
  in sub run-services at C:\rakudo\share\perl6\site\sources9F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 227
  in sub MAIN at C:\rakudo\share\perl6\site\sources9F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 199
  in block <unit> at C:\rakudo\share\perl6\site\resources\C1E87B0F084684C12CD87240AE4C12E746174570 line 1
  in sub MAIN at C:\rakudo\share\perl6\site\bin\cro line 3
  in block <unit> at C:\rakudo\share\perl6\site\bin\cro line 1

Died because of the exception:
    no such file or directory
      in any  at C:\rakudo\share/perl6/runtime/CORE.d.setting.moarvm line 1
      in sub run-services at C:\rakudo\share\perl6\site\sources9F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 227
      in sub MAIN at C:\rakudo\share\perl6\site\sources9F4B18755ADE6922C88B8C44A0930A5DDD77C9 (Cro::Tools::CLI) line 199
      in block <unit> at C:\rakudo\share\perl6\site\resources\C1E87B0F084684C12CD87240AE4C12E746174570 line 1
      in sub MAIN at C:\rakudo\share\perl6\site\bin\cro line 3
      in block <unit> at C:\rakudo\share\perl6\site\bin\cro line 1

不幸的是,这条错误消息不是对我说的。我想念什么?

更新

不知何故我错过了这个 Cro github issue yesterday when googling, which is precisely what my problem was. I backlinked this question+answer in the github issue. A fix has since been merged 它将成为下一个 Cro 版本的一部分。支持大家的快速反应!


原答案

这可以在 timotimo(谢谢!)的帮助下解决,

  • 建议 Cro::Tools::Runner 调用 perl6 而不是需要的 perl6.bat Windows.
  • 向我指出了 ,其中包含有关更改 zef 已安装模块中的代码的重要信息。

所以我转到 %USERPROFILE%\.zef\store\cro-0.8.1.tar.gz\cro-0.8.1\lib\Cro\Tools 并在 Runner.pm6 的第 269 行修补了可执行文件的名称。然后我回到 %USERPROFILE%\.zef\store\cro-0.8.1.tar.gz\cro-0.8.1 并使用以下命令重新编译并安装模块(注意 --/test 跳过测试,这会花费很多时间):

C:\...\.zef\store\cro-0.8.1.tar.gz\cro-0.8.1>zef install . --force-install --/test --verbose
The following local path candidates are already installed: .
===> Installing: cro:ver<0.8.1>
===> Install [OK] for cro:ver<0.8.1>

1 bin/ script [cro] installed to:
C:\rakudo\share\perl6\site\bin

现在,cro run 向我吐出我认为是 ANSI 代码的内容,但它正在工作:)

C:\ws\perl6\hello>cro run
←[1;32mÔûÂ Starting hello (hello)←[0m
←[32m­ƒöî Endpoint HTTP will be at http://localhost:20000/←[0m
←[32m­ƒôô hello ←[0mListening at http://localhost:20000