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

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

问题描述

我在Surface Pro 3上安装了Rails,并在尝试查看页面后遇到此错误。我已经尝试了一些建议,例如用libv8安装rubyracer但它没有帮助。


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


这是我的宝石文件:

  source'http ://rubygems.org'


#捆绑边缘Rails代替:gem'rail',github:'rails / rails'
gem'trail','4.1.8 '
#使用sqlite3作为Active Record的数据库
gem'sqlite3'
#将SCSS用于样式表
gem'sss-rails','〜> 4.0.3'
#使用Uglifier作为JavaScript资源的压缩器
gem'uglifier','> = 1.3.0'
#将CoffeeScript用于.js.coffee资产和视图
gem'coffee-rails','〜> 4.0.0'
#请参阅https://github.com/sstephenson/execjs#readme获取更多支持的运行时
gem'therubyracer',平台:: ruby​​
#使用jquery作为JavaScript library
gem'jquery-rails'
#Turbolinks可以更快地在您的Web应用程序中建立以下链接。阅读更多:https://github.com/rails/turbolinks
gem'turbolinks'
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder','〜> 2.0'
#bundle exec rake doc:rails在doc / api下生成API。
gem'sdd','〜> 0.4.0',group :: doc
gem'libv8','〜> 3.16.14.7'

#使用ActiveModel has_secure_password
#gem'bcrypt','〜> 3.1.7'

#使用独角兽作为app服务器
#gem'unicorn'

#使用Capistrano进行部署
#gem'capistrano- rails',group ::开发

#使用调试器
#gem'调试器',组:[:开发,:测试]

#Windows不包括zoneinfo文件,所以捆绑tzinfo-data gem
gem'tzinfo-data',平台:[:mingw,:mswin]
gem'trip-bootstrap-rails',:git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem'font-awesome-rails'
gem'simple_form'
gem'dedeise'


解决方案

与流行的看法相反,Rails不是跨平台兼容的,因为他们声称。如果它是在窗户上工作,开箱即用。像你一样,我尝试了所有可用的选项。



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



<我改变了execjs使用UTF-8和jscript,没有效果。这是通过编辑 C:\ RailsInstaller \Ruby2.1.0 \lib \ruby \gems \2.1.0 \gems \ execjs-2.2.2 \lib \ execjs \来完成的。 runtimes.rb 将JScript =块更改为以下内容。

  JScript = ExternalRuntime.new(
name:JScript,
命令:cscript // E:jscript // Nologo,
runner_path:ExecJS.root +/ support / jscript_runner.js,
编码:'带有// U的UTF-8'#CScript返回UTF-16LE

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



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

  gem'coffee-script-source','1.9 .0'

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



然后我安装了node.js,这个工作了5分钟,直到我生成了一个新的控制器,它再次被打破。



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



最后解决这个问题的方法是打开 app \assets \ javascripts \ application.js 文件并删除最后一行



< s> // = require_tree。



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

  npm install -g coffee-script 


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 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)

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'

解决方案

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.

This was solved using Ruby 2.1.5p273/Rails 4.2.0

I changed execjs to use UTF-8 with jscript, no effect. This was done by editing C:\RailsInstaller\Ruby2.1.0\lib\ruby\gems\2.1.0\gems\execjs-2.2.2\lib\execjs\runtimes.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
)

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.

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

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

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

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

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.

Finally what fixed this problem was to open up the app\assets\javascripts\application.js file and remove the last line which says

//= require_tree .

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

npm install -g coffee-script

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

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