对象不支持此属性或方法 Rails Windows 64bit [英] Object doesn't support this property or method Rails Windows 64bit

查看:23
本文介绍了对象不支持此属性或方法 Rails Windows 64bit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Surface Pro 3 上安装了 Rails,并在尝试查看页面后遇到此错误.我尝试了一些建议,例如使用 libv8 安装 ruby​​racer,但没有帮助.

I installed Rails on my Surface Pro 3 and run into this error after trying to view a page. I have tried several suggestions such as installing rubyracer with libv8 but it didn't help.

TypeError: Object 不支持此属性或方法(在c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)

TypeError: Object doesn't support this property or method (in c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)

这是我的 gemfile:

Here is my gemfile:

source 'http://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/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
gem 'libv8', '~> 3.16.14.7'

# 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

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'font-awesome-rails'
gem 'simple_form'
gem 'devise'

推荐答案

与流行的看法相反,Rails 并不像他们声称的那样跨平台兼容.如果是这样,它可以在 Windows 上运行,开箱即用.和你一样,我已经尝试了所有可用的选项.

Contrary to popular belief, Rails is NOT cross platform compatible as they claim. If it was it would work on windows, out of the box. Like you I have tried every available option.

这是使用 Ruby 2.1.5p273/Rails 4.2.0 解决的

This was solved using Ruby 2.1.5p273/Rails 4.2.0

我将 execjs 更改为在 jscript 中使用 UTF-8,没有效果.这是通过编辑 C:RailsInstallerRuby2.1.0lib ubygems2.1.0gemsexecjs-2.2.2libexecjs untimes.rb 更改 JScript =阻止以下内容.

I changed execjs to use UTF-8 with jscript, no effect. This was done by editing C:RailsInstallerRuby2.1.0lib ubygems2.1.0gemsexecjs-2.2.2libexecjs untimes.rb changing the JScript = block to the following.

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
)

我还尝试安装 therubyracer,这会导致无法编译 libv8 依赖项的问题.我将我的 python 2.7 安装添加到 Windows 系统路径,并安装了 libv8.然后它说安装了 libv8,但是当我尝试安装 therubyracer 时,它说找不到 libv8.我卸载了 libv8 并再次尝试,它说无法编译 libv8.这足以让我确定 therubyracer 不能在 Windows 上运行,所以我将它从 Gemfile 中注释掉,将 python 2.7 留在我的 Windows 系统路径上.

I also tried installing therubyracer which leads to problems with the libv8 dependency not compiling. I added my python 2.7 install to the windows system path, and installed libv8. Then it said libv8 was installed but when I tried to install therubyracer it said libv8 couldn't be found. I uninstalled libv8 and tried again and it said libv8 couldn't be compiled. That was enough for me to determine that therubyracer was not going to work on windows, so I commented it out of my Gemfile, leaving python 2.7 on my windows system path.

我更新了 coffee-script-source,将以下内容添加到我的 Gemfile 中

I updated coffee-script-source, by adding the following to my Gemfile

gem 'coffee-script-source', '1.9.0'

将 coffee-script-source 添加到我的 Gemfile 后,我运行了 gem update coffee-script-source ,这也没有解决问题.

After adding coffee-script-source to my Gemfile I ran gem update coffee-script-source , this also didn't solve the problem.

然后我安装了 node.js,这工作了 5 分钟,直到我生成了一个新的控制器,然后它又坏了.

I then installed node.js, this worked for 5 minutes until I generated a new controller, and it was broken again.

注意:安装 node.js 后,您需要打开一个新的命令提示符以获取安装 node.js 时设置的系统路径的更新.

Note: After installing node.js you need to open a new command prompt to get the updates to your system path that are setup when node.js installs.

最后解决这个问题的是打开appassetsjavascriptsapplication.js文件并删除最后一行

Finally what fixed this problem was to open up the appassetsjavascriptsapplication.js file and remove the last line which says

//= require_tree .

最后运行以下命令以确保在 Node.js 中正确安装了咖啡脚本

Lastly run the following command to make sure coffee-script is properly installed in Node.js

npm install -g coffee-script

这篇关于对象不支持此属性或方法 Rails Windows 64bit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆