Cannot install state_machines gem in Windows environment

两盒软妹~` 提交于 2019-12-24 22:26:40

问题


I am new to Rails and would like to check how Spree ecommerce solution looks like before the customization. That's why I installed Ruby from RubyInstaller, DevKit, Rails, Spree etc.

During installation of state_machines gem, below error appears and the gem is eventually not installed.

C:\>gem install state_machines 

ERROR:  While executing gem ... (Errno::EINVAL)
Invalid argument @ rb_sysopen - C:/Dev/Ruby/lib/ruby/gems/2.1.0/gems/state_m
achines-  0.2.2/test/unit/node_collection/node_collection_after_being_copied_test.rb

This has impact on the bundle install of spree project later on:

Errno::EINVAL: Invalid argument @ rb_sysopen - C:/Dev/Ruby/lib/ruby/gems/2.1.0/g
ems/state_machines-0.2.2/test/unit/node_collection/node_collection_after_being_c
opied_test.rb
An error occurred while installing state_machines (0.2.2), and Bundler cannot
continue.Make sure that `gem install state_machines -v '0.2.2'` 
succeeds before bundling.

Current ruby version installed is: ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32] + devkit

rails version is 4.2.0

I am running on Windows environment, without any possibility to move to Linux.


回答1:


I ran into this too.

Looks like state_machines has some test case files that have a newline in the name. I'd bet that is the cause of the issue. I've submitted a pull request over here: https://github.com/state-machines/state_machines/pull/11 In the meantime, my branch doesn't have the issue: https://github.com/jeff-hamm/state_machines

The specific fix (for the moment, until the pullrequest is accepted) is:

git clone https://github.com/jeff-hamm/state_machines
cd state_machines
bundle gem state_machines
rake install

After doing that, 'gem install spree_core' worked just fine on windows.

Keep in mind I am not planning on keeping my branch up to date (I will delete it if the request is accepted), so, that clone url won't be ideal for long



来源:https://stackoverflow.com/questions/29110202/cannot-install-state-machines-gem-in-windows-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!