2015-04-02 74 views
-1

我剛通過rails安裝程序在我的windows PC上安裝了rails - 而且我不知道有關rails或任何其他內容......在創建我的第一個應用程序之後軌道新XXX),並創建了第一個控制器和視圖,我跑了服務器,我看到的第一件事情是一個錯誤:Rails的第一個應用程序錯誤 - Errno :: ENOENT

Errno::ENOENT 

    Showing C:/Sites/XXX/XXX/app/views/layouts/application.html.erb where line #5 raised: 

    No such file or directory @ unlink_internal - C:/Users/XXX/AppData/Local/Temp/execjs20150402-8140-cy5cjejson 
     (in C:/Sites/XXX/XXX/app/assets/stylesheets/application.css.sass) 
再次

,我沒碰過我的軌道不斷,並沒有寫任何代碼但仍然有這個錯誤...我搜索了幾個小時在線的答案,但沒有人幫助我或解決了我的問題...我嘗試安裝Node.js,exejs,但沒有任何幫助。

注: 我注意到,如果我在應用程序模板中刪除

<%= stylesheet_link_tag "application", :media => "all" %> 
    <%= javascript_include_tag "application" %> 

,網站正常運行(但我不想刪除它 - 我需要它)

我怎麼解決這個問題?

編輯:我的寶石文件:

source 'https://rubygems.org' 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.1' 
# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 

    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

回答

0

變化青菜護欄版本4.0.3,剩下的,因爲它是。刪除Gemfile.lock的必要的時候,然後:

bundle update 
bundle install 

最後,不要忘了重新啓動軌道服務器!

+0

不是它顯示我這個錯誤:'顯示C:/Sites/temp/app/views/layouts/application.html.erb在哪裏行#6引發: 沒有這樣的文件或目錄@ unlink_internal - C :/ Users/XXX/AppData/Local/Temp/execjs20150402-7900-l8y4j5json (位於C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets /javascripts/turbolinks.js.coffee)' – user3926081 2015-04-02 19:06:18

+0

發佈你的gemfile。 – 2015-04-02 19:13:26

+0

增加了它(在你建議更改之前) – user3926081 2015-04-02 19:15:25

1

選項:

1)刪除//= require_tree ./忽略的問題 - 正如ColinR如上所述,這行不應該被擺在首位造成的問題。 ExecJS在您的系統上運行JavaScript運行時存在一個實際問題,刪除這一行只是忽略了這個事實。

2)安裝Node.js的/出走 - 許多人似乎只是在最後安裝的Node.js和使用的,而不是已經在他們的系統中的JavaScript運行。雖然這是一個有效的選項,但它也需要額外的軟件,並且只避免原始問題,即ExecJS無法正常使用系統中已有的JavaScript運行時。如果系統上現有的JavaScript運行時應該工作,爲什麼不讓它工作而不是安裝更多的軟件?按照ExecJS創造者,已經內置到Windows運行時,其實是在支持...

ExecJS lets you run JavaScript code from Ruby. It automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object.

ExecJS supports these runtimes:

therubyracer - Google V8 embedded within Ruby therubyrhino - Mozilla Rhino embedded within JRuby Node.js Apple JavaScriptCore - Included with Mac OS X Microsoft Windows Script Host (JScript) (from github.com/sstephenson/execjs#execjs)

3)其實固定的問題/學習 -使用的選項1和2中的知識,以尋找其他的解決方案。我無法告訴您在查看選項1或2時關閉的網頁有多少是我們接受的解決方案,然後才找到有關我們遇到的根本問題的信息。我們一直在尋找的唯一原因是我們無法相信Rails團隊會(1)在引起問題的每個支架生成項目中插入一行代碼,或者(2)要求我們安裝額外的軟件來運行該默認值代碼行。因此,我們最終解決了根本問題(您的里程可能會有所不同)。

該修復程序適用於我們:在出現問題的系統上,找到ExecJS的runtimes.rb文件。它看起來像this。複製找到的文件進行備份。打開原始runtimes.rb進行編輯。找到以行JScript = ExternalRuntime.new開頭的部分(在該部分中,在包含:command => "cscript //E:jscript //Nologo //U",的行上 - 僅刪除//U,然後在包含:encoding => 'UTF-16LE' # CScript with //U returns UTF-16LE - change UTF-16LEUTF-8的行上保存對該文件的更改。 :

JScript = ExternalRuntime.new(
    :name  => "JScript", 
    :command  => "cscript //E:jscript //Nologo", 
    :runner_path => ExecJS.root + "/support/jscript_runner.js", 
    :encoding => 'UTF-8' # CScript with //U returns UTF-16LE 
) 

接下來,停止然後重新啓動您的Rails服務器並刷新頁面在瀏覽器中所產生的原始錯誤希望在頁面加載沒有錯誤,現在這裏就是我們最初發布我們的研究結果的ExecJS問題線程:。https://github.com/sstephenson/execjs/issues/81#issuecomment-9892952

如果這沒有解決問題,你總是可以改寫e修改後的runtimes.rb與您(希望)製作的備份副本,一切都將回到原點。在這種情況下,請考慮選項3並繼續搜索。讓我們知道最終對你有什麼作用。除非它刪除require_tree或安裝node.js,否則已經有很多事情正在進行。 :)

+0

對不起,我試過3號號碼,試過安裝node.js - 沒有幫助,我遇到的問題與你試圖解決的問題不一樣:( – user3926081 2015-04-02 19:37:53

相關問題