0

在 Windows 中运行 cmd 时出错请帮我做什么:这里是 rake

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for
example lib/tasks/capistrano.rake, and they will automatically be available to 
Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'

这是cmd窗口

c:\Fedena>rake db:create --trace
(in c:/Fedena)
rake aborted!
c:/Fedena/Rakefile:3: syntax error, unexpected kAND
...lib/tasks/capistrano.rake, and they will automatically be av...
                              ^
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby187/bin/rake:23:in `load'
C:/Ruby187/bin/rake:23
4

2 回答 2

1

这部分不应该注释掉吗?

    # Add your own tasks in files placed in lib/tasks ending in .rake,
# for
#example lib/tasks/capistrano.rake, and they will automatically be available to 
#Rake.


require(File.join(File.dirname(__FILE__), 'config', 'boot'))


require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'

看起来它没有被注释掉,并且 ruby​​ 正在尝试将它作为代码运行

于 2017-02-05T07:18:38.470 回答
0

我的安装成功了。以下是我的 rake 文件内容:

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'

将上述内容复制并粘贴到您的 rake 文件中,然后重试

于 2017-10-16T00:50:11.917 回答