问题描述
我希望WSL2能够解决这些问题,并在接下来的6个月左右使这个问题过时,但是与此同时,我对于在主要笔记本电脑上运行Windows的前沿技术或其他预览版感到不舒服。
I'm hoping that WSL2 solves these problems and makes this question obsolete in the next 6 months or so, but in the meantime, I don't feel comfortable running bleeding edge or other preview releases of Windows on my primary laptop.
有时候,当我安装Ruby gems(捆绑安装
或捆绑安装- -path = vendor / bundle
)在WSL中,安装带有本机扩展的gem时出现权限被拒绝
错误。
Sometimes, when I'm installing Ruby gems (bundle install
or bundle install --path=vendor/bundle
) inside of WSL, I get Permission denied
errors when installing a gem with a native extension.
此错误的最新体现是:
Permission denied @ rb_file_s_rename - (./.gem.20191006-12131-11th7ub/byebug, /home/thomasowens/project/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0-static/byebug-11.0.1/byebug)
要解决此问题,我只删除了 / home / thomasowens / project / vendor /bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0-static/byebug-11.0.1/byebug
,重新运行bundle命令,它成功完成。有时,我需要多次执行此操作,但通常可以。
To resolve it, I simply deleted /home/thomasowens/project/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0-static/byebug-11.0.1/byebug
, reran the bundle command, and it succeeded. Sometimes, I need to do this multiple times, but it usually works.
最后,我可以正确安装所有gem,但是设置起来很困难一个新项目,并且有许多具有本机扩展的宝石。当我引入一个新的gem或更新一个gem导致需要更新本机依赖项时,也是如此。
In the end, I can get all of the gems installed properly, but it's hard when setting up a new project and there are many gems with native extensions. Same when I'm introducing a new gem or updating a gem that causes the native dependencies to need to be updated.
关于这个问题,我没有发现太多,但是我想知道是否可以做些事情来减轻需要多次运行捆绑安装
来使项目在WSL下建立并运行的痛苦。
I haven't found much about this issue, but I'm wondering if there is something that I can do to alleviate the pain of needing to run bundle install
multiple times to get a project set up and running under WSL.
推荐答案
我遇到的问题可能与Visual Studio Code的文件监视有关。反映在针对WSL的两个GitHub问题中-和。 Visual Studio Code具有 remote.WSL.fileWatcher.polling
,可以启用它来解决此问题。但是,,并且可能还需要调整 remote.WSL.fileWatcher.pollingInterval
设置。 WSL2将解决这些问题。
The problem that I'm experiencing may be related to Visual Studio Code's file watching. It is reflected in two GitHub issues against WSL - 1956 and 3395. Visual Studio Code has remote.WSL.fileWatcher.polling
, which can be enabled which works around this issue. However, the documentation states that there is a performance impact for large workspaces and it may be necessary to also adjust the remote.WSL.fileWatcher.pollingInterval
setting. WSL2 will resolve these issues.
自启用此标志以来,在运行VS Code时我没有看到错误。
Since enabling this flag, I haven't seen the error while working with VS Code running.
现在WSL2退出了,我能够禁用该标记并且问题没有再出现。看来,如果可以升级到WSL2,则可能是首选的解决方案。但是,对于尚未升级或无法升级的任何人,请切换 remote.WSL.fileWatcher.polling
和 remote.WSL.fileWatcher .pollingInterval
应该很好。
Now that WSL2 is out, I was able to disable this flag and the issue has not reappeared. It appears that if you can upgrade to WSL2, that may be a preferred solution. However, for anyone who hasn't yet upgraded or can't upgrade, toggling the remote.WSL.fileWatcher.polling
and remote.WSL.fileWatcher.pollingInterval
should be good.
这篇关于在用于Linux的Windows子系统上安装具有本机扩展的Ruby gem时,是否存在一种可靠的方法来避免权限被拒绝错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!