首页 > 解决方案 > /c/Ruby30-x64/bin/rake:第 4 行:{#:找不到命令

问题描述

我目前正在使用 git bash 我尝试将 Rakefile 添加到我的存储库中。这是我在 Rakefile 中写的:

#!/usr/bin/ruby -wKU

task :default => :run

task :run do
  require './lib/hello'
end

然后我做了这两个步骤:

git add Rakefile
git commit -m "Added a Rakefile."

然后,我使用 rake 命令运行我的 hello 程序。
这是我的 hello.rb 程序:

# Default is "World"
# Author: Jim Weirich (jim@somewhere.com)
name = ARGV.first || "World"```

puts "Hello, #{name}!"

当我运行 rake 命令时,我得到了这个:

/c/Ruby30-x64/bin/rake: line 4: {#: command not found
Hello, World!

为什么我在 hello world 上方出现错误?

提前致谢。

标签: rack

解决方案


推荐阅读