这是日志:http://pastebin.com/CAgur9xd
Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160720-8272-c88sgk.rb extconf.rb --with-cflags=-std=c99
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby2.2.0/bin/$(RUBY_BASE_NAME)
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable …Run Code Online (Sandbox Code Playgroud) 我正在为一个RoR网站写一个聊天页面.我把它全部用HTML编写,我试图用ajax实现它.有一个提交消息的表单.表单标签读取<%= form_for(@chat, remote: true, :authenticity_token => true) do |f| %>
我的整个观点:
<!DOCTYPE html>
<html>
<head>
<title>Battleriskopoloy - Communications</title>
</head>
<body>
<br>
<div id="heading_1" align="center">
<br><span id="title"><strong>[ . . . Communications . . . ]</strong></span>
</div><br>
<div id="sidebar"><br>
<% $chat_users.each do |user| %>
<% user = User.find_by_username(user) %>
<%= button_to user.username, flop_chat_path(user), :class => "select", :method => :get %>
<% end %>
</div>
<div id="display">
<% $messeges.each do |i| %>
<% if i[1] == "from" %>
<p style="color:#000000; text-align:right; margin-right:5%;font-family:courier"><%= …Run Code Online (Sandbox Code Playgroud) 确切的错误是:
An error occurred while installing nio4r (1.2.1), and bundler cannot continue. Make sure that 'gem install nio4r -v '1.2.1'' succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
这是一个痕迹:
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.1
Using minitest 5.10.1
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 2.0.1
Installing nio4r 1.2.1 with native extensions
Errno::EACCES: Permission denied @ rb_sysopen - /Users/lukeplourde/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1/.gitignore
Using …Run Code Online (Sandbox Code Playgroud) 我在自己的网站上制作了一个网页,该网页将使用jquery嵌入到另一个网站中。我必须提供jquery代码,以便当我们从嵌入了我的网页的另一个站点访问URL时,我的内容会在页面加载时加载。我无法使用iframe。我用过.html,.load和.ajax,但是它们总是会出现错误
XMLHttpRequest无法加载http://mypage.com/index?user_id=82。所请求的资源上没有“ Access-Control-Allow-Origin”标头。因此,不允许访问源“ localserver:port”。
我的页面设置是否有问题
我检查了这些:
$('#siteloader').load('http://mypage.com/index?user_id=82');
$("#siteloader").html('<object data="http://mypage.com/index?user_id=82">');
Run Code Online (Sandbox Code Playgroud)
请建议
我今天遇到了同样的问题并提出了一个建议:bundle exec在你的命令前面可以解决这个问题.
预先捆绑exec没有帮助(我已经这样做了).
弹簧停止和弹簧重启没有帮助.
我需要这样做:捆绑更新弹簧 对我有用.
有没有更好的解决方案来修复使用以前的gemlock文件中的弹簧版本?
我一直收到这个错误:
throw Error("LoadError:cannot load such file -- uglifier\n (in /var/www/dev/app)
Run Code Online (Sandbox Code Playgroud)
我无法在Rails 4.1.4上处理此错误.这是我的Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.4'
gem 'mysql2'
gem 'jquery-rails'
gem 'devise'
gem 'spring', group: :development
gem 'unicorn'
Run Code Online (Sandbox Code Playgroud)
我尽量保持应用程序尽可能轻,所以我删除了turbolinks,以及所有那些初始宝石:
-gem 'sass-rails', '~> 4.0.3'
-gem 'uglifier', '>= 1.3.0'
-gem 'coffee-rails', '~> 4.0.0'
-gem 'turbolinks'
Run Code Online (Sandbox Code Playgroud)
我使用rake assets:precompile或者RAILS_ENV=production rake assets:precompile我一直认为JS文件编译错误.
这是我的application.js:
//= require jquery
//= require jquery_ujs
//= require_tree .
Run Code Online (Sandbox Code Playgroud)
这是我的production.rb:
# Compress JavaScripts and CSS.
# config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback …Run Code Online (Sandbox Code Playgroud) 我试图在我的"团队"模型中编写一个方法,但current_user显示此错误
未定义的局部变量或方法`current_user'for#
def set_default_url
if current_user.id == self.user_id
"/assets/default_black_:style_logo.jpg"
else
"/assets/default_:style_logo.jpg"
end
end
Run Code Online (Sandbox Code Playgroud)
current_user方法适用于其他模型和控制器.我这样称呼这个方法.
has_attached_file :logo, :styles => {
:medium => "200x200#",
:thumb => "100x100#",
:small => "50x50#"
},
:default_url => :set_default_url
Run Code Online (Sandbox Code Playgroud)
我使用rails 3.2,ruby 1.9.3和设计3.1.这似乎是一项简单的任务,但我不明白故障所在.如果有人帮助我,我会非常感激.
我有:
|123|456|789|
Run Code Online (Sandbox Code Playgroud)
|123|我只能使用正则表达式捕获
\|(\d*)\|
Run Code Online (Sandbox Code Playgroud)
但不确定如何捕获完整的字符串。我对此很陌生。
我将感谢任何帮助
我最近在我的 Rails 应用程序中更新了一些包,现在我的资产没有被提供。相反,我收到以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)
我的资产是预编译的:
资产.rb
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile …Run Code Online (Sandbox Code Playgroud) 它们看起来是等效的,但是当比较它们时,它是错误的:
5.is_a? Fixnum
# => true
5.is_a? Numeric
# => true
Numeric == Fixnum
# => false
Run Code Online (Sandbox Code Playgroud)