简体   繁体   English

Ruby On Rails,错误运行命令“ rails generate controller”,输入/输出错误@ rb_sysopen,(Errno :: EIO)

[英]Ruby On Rails, Error running command “rails generate controller”, Input/output error @ rb_sysopen, (Errno::EIO)

In the beginning, when I run rails generate controller welcome homepage into my project's dir, the command works OK and produces the app/controllers/welcome_controller.rb and route get welcome/homepage 开始时,当我运行rails generate controller welcome homepage到我的项目目录中时,该命令运行正常,并生成app/controllers/welcome_controller.rb并发送路线get welcome/homepage

User1@My-Machine:~/MyProject$ rails generate controller welcome homepage
/home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/app_rails_loader.rb:39: warning: Insecure world writable dir /home/User1/.rbenv/versions in PATH, mode 040777
      create  app/controllers/welcome_controller.rb
       route  get 'welcome/homepage'

immediately after that, the command runs into the following error: 之后,该命令立即遇到以下错误:

/home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in `binread': Input/output error @ rb_sysopen - /home/User1/MyProject/config/routes.rb (Errno::EIO)

followed by a list of files. 然后是文件列表。

        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in `replace!'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:59:in `invoke!'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:30:in `insert_into_file'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/generators/actions.rb:224:in `block in route'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:194:in `block in in_root'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:184:in `block in inside'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/2.3.0/fileutils.rb:128:in `chdir'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/2.3.0/fileutils.rb:128:in `cd'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:184:in `inside'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:194:in `in_root'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/generators/actions.rb:223:in `route'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/generators/rails/controller/controller_generator.rb:16:in `block in add_routes'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/generators/rails/controller/controller_generator.rb:15:in `reverse_each'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/generators/rails/controller/controller_generator.rb:15:in `add_routes'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/generators.rb:157:in `invoke'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/generate.rb:13:in `<top (required)>'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:130:in `generate_or_destroy'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:50:in `generate'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /home/User1/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

Does anyone know how this can be resolved? 有人知道如何解决吗?

This answer is a bit of a copout, but my experience with the current versions of WSL is that rbenv has issues running in WSL, wheras RVM seems to work okay. 这个答案有点不合时宜,但是我对当前版本的WSL的经验是rbenv在WSL中运行时有问题,而RVM似乎可以正常工作。 The original question sounds like you may be moving linux specific files like /home/user/file (from the appdata area) from the Windows interface -- definitely don't do that. 最初的问题听起来像是您可能正在从Windows界面移动linux特定文件,例如/ home / user / file(来自appdata区域)-绝对不要这样做。 Only manipulate those files from bash, as corruption and oddities will occur . 仅从bash操作这些文件,因为会发生损坏和奇怪的情况

Not sure why things aren't being created or seen correctly in your setup, but in general, here's what has worked for me: 不确定为什么无法在您的设置中创建或正确显示事物,但是总的来说,这对我有用:

Using RVM, and with the help of this guy I came to the conclusion that I need to 使用RVM,并在这个家伙的帮助下,我得出结论,我需要

bundle config --delete bin
rake rails:update:bin
git add bin

and use 和使用

bash --login

to log into the interactive version of bash from Windows. 从Windows登录到bash的交互式版本。

I've been successfully creating and working with projects from both Bash and Windows in the mounted space, ie /mnt/c/Users/Tim/Desktop/railsapp 我已经成功地从Bash和Windows的挂载空间(即/mnt/c/Users/Tim/Desktop/railsapp创建和使用项目

I run generators and whatnot from bash, but edit the content of the files from Sublime in Windows. 我从bash运行生成器而不是其他东西,但是在Windows中从Sublime编辑文件的内容。

Good luck! 祝好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails4-错误Errno :: EINVAL:无效的参数@ rb_sysopen-路径/路径/路径 - Rails4 - ERROR Errno::EINVAL: Invalid argument @ rb_sysopen - path/path/path Rails 控制台访问权限被拒绝@rb_sysopen 错误 - Rails console access gets Permission denied @ rb_sysopen Error ruby on rails Errno :: EACCES权限被拒绝@ rb_sysopen-product.log - ruby on rails Errno::EACCES Permission denied @ rb_sysopen - product.log rails 4:Errno :: ENOENT(没有这样的文件或目录@ rb_sysopen - / assets / - rails 4: Errno::ENOENT (No such file or directory @ rb_sysopen - /assets/ 正在获取Errno :: ENOENT:此类文件或目录@ rb_sysopen尝试在Roo gem中打开远程文件url时(Ruby on rails) - Getting Errno::ENOENT: No such file or directory @ rb_sysopen When trying to open remote file url in Roo gem(Ruby on rails) 错误:尝试在我的rails应用程序中安装gem pg时,权限被拒绝@ rb_sysopen(Windows 7) - Error: Permission Denied @ rb_sysopen when trying to install gem pg in my rails app (Windows 7) Rails gem 权限被拒绝@ rb_sysopen - Rails gem Permission denied @ rb_sysopen Rails如何解决错误文件名太长@ rb_sysopen - Rails How to resolve Error File name too long @ rb_sysopen 如何修复“请运行 rails webpacker:安装错误:没有这样的文件或目录@rb_sysopen”? - How to fix 'Please run rails webpacker: install Error: No such file or directory @ rb_sysopen"? Rails的公共目录中的文件-Errno :: ENOENT(无此类文件或目录@ rb_sysopen - Files in public directory in Rails - Errno::ENOENT (No such file or directory @ rb_sysopen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM