我有Bundler和Capistrano的rails 3项目.一切正常,但是当我运行rake specGemfile.lock更改时.改变是两条线交换.这是差异:
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -44,8 +44,8 @@ GEM
capistrano (2.5.20)
highline
highline
- net-scp
net-scp (>= 1.0.0)
+ net-scp
net-sftp
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
Run Code Online (Sandbox Code Playgroud)
当我rake spec再次运行时,线路再次交换并且更改被撤消.我对这种行为感到非常困惑.有谁知道可能导致这种情况的原因是什么?
当我们编写Rails应用程序时,它需要Gemfile为我们定义的所有宝石.
如何制作非Rails应用程序呢?
我以为我了解 Bundler 是如何处理 gem 的,但是在最近发生的事情之后,我不确定我的理解是否正确。
我正在开发一个 Rails 应用程序。首先(为了熟悉我以前从未使用过的 Rails 环境),我没有使用 IDE。但是,因为我错过了 IDE 的一些优势,所以我才开始使用 RubyMine。作为 RubyMine 设置的一部分,它要求更新我现有项目的所有 gem。
在那之后,我无法运行“rake [anything]”。每次我这样做时,我都会收到以下错误:
您已经激活了 rake 0.9.3.beta.1,但是您的 Gemfile 需要 rake 0.9.2.2。使用 bundle exec 可以解决这个问题。
我可以更新到下一个版本的 rake - 这不是问题 - 但我不明白首先发生了什么。我“激活”了较新版本的 rake 发生了什么。最终,我最终解决了这个问题
gem 'rake', '0.9.3.beta.1'
Run Code Online (Sandbox Code Playgroud)
在我的 Gemfile 中运行
bundle update rake
Run Code Online (Sandbox Code Playgroud)
但是,我仍然不确定这里发生了什么。如果我之前使用的是 9.2.2,为什么它会突然像那样爆炸,我将来如何防止这种情况发生?
在相应的目录中运行"bundle install"时,我得到了以下错误:
An error occurred while installing linecache19 (0.5.12), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
在尝试运行gem install linecache19 -v '0.5.12'(如上所述)时,我收到以下错误:
nishant@nishant-Inspiron-1545:~/voylla_website$ gem install linecache19 -v '0.5.12'
Building native extensions. This could take a while...
ERROR: Error installing linecache19:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for vm_core.h... no
/home/nishant/.rvm/gems/ruby-1.9.2-p320/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:39: Use RbConfig instead of obsolete and deprecated Config.
checking for vm_core.h... no
*** extconf.rb failed ***
Could …Run Code Online (Sandbox Code Playgroud) 我试图bundle在我的ruby项目的子文件夹中运行,但它似乎在我的初始目录的上下文中运行,即使我已将当前工作目录更改为子文件夹.
# change directories and run bundle in a sub directory:
# ruby script.rb
system('bundle')
system('cd sub_folder')
system('bundle')
Run Code Online (Sandbox Code Playgroud)
bundle命令成功运行,但仅适用于父文件夹.通过系统命令更改目录无法正确切换bundler的上下文,并为父文件夹gemfile运行两次.我错过了什么?
当我安装gem时,<insert gem name>它会失败并显示错误ERROR: Failed to build gem native extension.
例如,当我尝试在新服务器上安装gems json,eventmachine,mysql2时,它几乎总是失败。
注意:这是一个质量检查类型的问题,即请参阅以下我提出的解决方案或加入讨论。
我对在 Windows 上学习 Django + ReactJS 很感兴趣,所以我跟着这个循序渐进的教程。
现在,我处于捆绑阶段。当我运行我的打包器作为一个快速的健全性检查时:
$ node_modules/.bin/webpack --config webpack.dev.config.js
Run Code Online (Sandbox Code Playgroud)
我明白了node_modules is not recognized as a windows command。在尝试了不同的解决方案后,我发现使用node命令前面的webpack命令是在执行webpack。
这样做似乎启动,webpack但我收到此错误:
$ node node_modules/.bin/webpack --config webpack.dev.config.js
\node_modules\.bin\webpack:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3 …Run Code Online (Sandbox Code Playgroud) Rmagick 抱怨在尝试运行任何迁移时它坏了。在 OSX Sierra 上。
/Users/xyz/.rvm/gems/ruby-2.4.0@nucloud/gems/rmagick-2.16.0/lib/rmagick_internal.rb:12:in `require': dlopen(/Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/rmagick-2.16.0/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore-6.Q16.2.dylib
Referenced from: /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/rmagick-2.16.0/lib/RMagick2.bundle
Reason: image not found - /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/rmagick-2.16.0/lib/RMagick2.bundle (LoadError)
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/rmagick-2.16.0/lib/rmagick_internal.rb:12:in `<top (required)>'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/rmagick-2.16.0/lib/rmagick.rb:1:in `require'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/rmagick-2.16.0/lib/rmagick.rb:1:in `<top (required)>'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `require'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
from /Users/xyz/code/nc_rails5/config/application.rb:7:in `<top (required)>'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
from /Users/xyz/.rvm/gems/ruby-2.4.0@nc/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from …Run Code Online (Sandbox Code Playgroud) 在 Rails 控制台中,如何列出环境中已加载的 gem?
我正在使用 Gemfile 和 Rails 5。我四处搜索但没有结果。
我的“宝石”命令似乎有问题。这是我在运行“gem”时得到的
/usr/local/lib/site_ruby/2.3.0/rubygems/stub_specification.rb:114:in
initialize': Permission denied @ rb_sysopen - /var/lib/gems/2.3.0/specifications/unicode-display_width-1.4.1.gemspec (Errno::EACCES) from /usr/local/lib/site_ruby/2.3.0/rubygems/stub_specification.rb:114:inopen' from /usr/local/lib/site_ruby/2.3.0/rubygems/stub_specification.rb:114:indata' from /usr/local/lib/site_ruby/2.3.0/rubygems/stub_specification.rb:204:invalid?' 来自 /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:774:inselect' from /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:774:ingemspec_stubs_in' 来自 /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:798:inblock in map_stubs' from /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:795:ineach'来自 /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:795:inflat_map' from /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:795:inmap_stubs' 来自 /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:788:ininstalled_stubs' from /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:826:instubs'来自 /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:747:in_all' from /usr/local/lib/site_ruby/2.3.0/rubygems/specification.rb:1131:inlatest_specs' from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:546:infind_latest_files' from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:1111:inload_plugins' from / usr/local/lib/site_ruby/2.3.0/rubygems/gem_runner.rb:86:<top (required)>' from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in需要'来自 /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from /usr/bin/gem:9:in'
但是,如果我执行“sudo gem”,该命令运行良好。
更大的问题是我无法使用“捆绑”来安装新的 gems(例如,fastlane)。请注意,我正在使用“捆绑更新”通过 Gemfile 安装 gem。这与上面发布的完全相同的堆栈跟踪失败了。
我该如何解决这个问题?谢谢!