【问题标题】:Using Rake gem, no rakefile found使用 Rake gem,没有找到 rakefile
【发布时间】:2013-02-23 23:09:11
【问题描述】:

我正在尝试使用可选数据模块构建自定义版本的 Zepto.js。我对使用终端命令有点陌生,所以当事情不工作时,我通常不确定该怎么做!

我在 Mac 上安装了 Ruby 1.9.3p385。使用“gem install rake”安装 Rake gem 时,它似乎安装得很好。但是,使用 'rake' 命令会引发此错误:

rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/Users/matthew_ruddy/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
/Users/matthew_ruddy/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

我不是从这里做什么。我也无法让“捆绑”宝石工作,它会引发以下错误:

Could not locate Gemfile

不知从何而来。这是我在运行“gem list”时获得的已安装 gem 的列表。

*** LOCAL GEMS ***

bigdecimal (1.1.0)
bundle (0.0.1)
bundler (1.2.4)
io-console (0.3)
json (1.5.4)
minitest (2.5.1)
rake (10.0.3, 0.9.2.2)
rdoc (3.9.5)
rubygems-bundler (1.1.0)
rvm (1.11.3.6)

非常感谢任何帮助!

【问题讨论】:

    标签: ruby gem rake


    【解决方案1】:

    你猜,你在错误的目录。

    您需要使用“cd”命令切换到正确的目录。您可以使用“pwd”命令找出您所在的目录。

    以下是我在电脑上安装的步骤:

    1. 将存储库签出到 /tmp/zepto

      dan@computer:/home$ cd /tmp
      dan@computer:/tmp$ git clone 
      dan@computer:/tmp$ git clone git@github.com:madrobby/zepto.git
      Cloning into 'zepto'...
      remote: Counting objects: 5721, done.
      remote: Compressing objects: 100% (1962/1962), done.
      remote: Total 5721 (delta 3937), reused 5333 (delta 3602)
      Receiving objects: 100% (5721/5721), 6.11 MiB | 475 KiB/s, done.
      Resolving deltas: 100% (3937/3937), done.
      
    2. 切换到 /tmp/zepto 目录

      dan@computer:/tmp$ cd zepto/
      dan@computer:/tmp/zepto (master)$ pwd
      /tmp/zepto
      
    3. 使用 bundler 安装 gems

      dan@computer:/tmp/zepto (master)$ bundle
      Fetching gem metadata from http://rubygems.org/....
      Fetching https://github.com/lautis/uglifier
      remote: Counting objects: 750, done.
      remote: Compressing objects: 100% (386/386), done.
      remote: Total 750 (delta 381), reused 670 (delta 304)
      Receiving objects: 100% (750/750), 278.16 KiB | 283 KiB/s, done.
      Resolving deltas: 100% (381/381), done.
      Installing rake (0.9.2.2) 
      Installing multi_json (1.6.1) 
      Installing execjs (1.4.0) 
      Using uglifier (1.3.0) from https://github.com/lautis/uglifier (at master) 
      Using bundler (1.2.3) 
      Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
      
    4. 使用 rake 构建 zepto

      dan@computer:/tmp/zepto (master)$ bundle exec rake
      Original version: 54.021k
      Minified: 24.897k
      Minified and gzipped: 9.258k, compression factor 5.835
      
    5. 检查 zepto.js 文件是否已构建

      dan@computer:/tmp/zepto (master)$ ls -l dist/
      total 124
      -rw-rw-r-- 1 daniel daniel 55317 Feb 23 23:32 zepto.js
      -rw-rw-r-- 1 daniel daniel 25495 Feb 23 23:32 zepto.min.js
      -rw-rw-r-- 1 daniel daniel 38097 Feb 23 23:32 zepto.min.js.map.json
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-07
      • 1970-01-01
      • 2011-05-29
      • 2016-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多