简体   繁体   English

运行“rails s”后如何修复“路径中不安全的世界可写目录/mnt/c,模式040777”错误

[英]How to fix "Insecure world writable dir /mnt/c in PATH, mode 040777" error after running "rails s"

I tried changing the permissions but it's still not working.我尝试更改权限,但仍然无法正常工作。 I created a new Rails app to test it and got the same error when I tried to start the Rails server.我创建了一个新的 Rails 应用程序来测试它,当我尝试启动 Rails 服务器时遇到了同样的错误。 And I get the same error when I run rails -v in the application folder.当我在应用程序文件夹中运行rails -v时,我遇到了同样的错误。

How do I fix this?我该如何解决?

rails s output: rails s输出:

/usr/lib/ruby/vendor_ruby/rails/app_rails_loader.rb:39: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
    /usr/bin/ruby2.5: warning: shebang line ending with \r may cause problems
    Ignoring executable-hooks-1.6.0 because its extensions are not built. Try: gem pristine executable-hooks --version 1.6.0
    Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0       
    Ignoring nio4r-2.5.2 because its extensions are not built. Try: gem pristine nio4r --version 2.5.2
    Ignoring nokogiri-1.10.7 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.7
    Ignoring websocket-driver-0.7.1 because its extensions are not built. Try: gem pristine websocket-driver --version 0.7.1
    Traceback (most recent call last):
            4: from bin/rails:3:in `<main>'
            3: from bin/rails:3:in `load'
            2: from /mnt/c/Users/max/Desktop/Dev/app_project/bin/spring:8:in `<top (required)>'
            1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler (LoadError)

My Gemfile:我的 Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

gem 'rails', '~> 6.0.0'
gem 'sqlite3', '~> 1.4'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5'
gem 'webpacker', '~> 4.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'


gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'better_errors', '~> 2.5', '>= 2.5.1'
end

group :test do
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  gem 'webdrivers'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'bootstrap', '~> 4.4.1'

gem 'devise', '~> 4.7', '>= 4.7.1'
gem 'jquery-rails'
gem 'toastr-rails'

gem 'omniauth', '~> 1.9'

gem 'omniauth-facebook', '~> 5.0'

lsb_release -a output: lsb_release -a输出:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

rvm list output: rvm list输出:

=* ruby-2.6.5 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

gem -v output: gem -v输出:

3.1.2

ruby -v output: ruby -v输出:

ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

Are you using WSL?你在使用 WSL 吗?

Since C drive ( /mnt/c ) is a Windows partition it doesn't share the file/dir permission system from Ubuntu(Linux).由于 C 驱动器 ( /mnt/c ) 是 Windows 分区,它不共享来自 Ubuntu(Linux) 的文件/目录权限系统。

" warning: Insecure world writable dir /mnt/c in PATH, mode 040777 #1426 " from WSL can be useful. 警告:路径中不安全的世界可写目录 /mnt/c,模式 040777 #1426 ”来自 WSL 可能很有用。

I encountered this on macOS while I was doing things with Cocoapods .我在使用Cocoapods在 macOS 上遇到了这个问题。 sudo chmod 755 /your/directory helped me get rid of this issue. sudo chmod 755 /your/directory帮助我摆脱了这个问题。 Hope it can work for you.希望它可以为你工作。

I faced this issue on Windows 10 WSL, Ubuntu 18.04, and I solved it by:我在 Windows 10 WSL、Ubuntu 18.04 上遇到了这个问题,我通过以下方式解决了这个问题:

  • Opening or initializing wsl.conf file under the /etc folder like this: sudo nano /etc/wsl.conf打开或初始化/etc文件夹下的wsl.conf文件,如下所示: sudo nano /etc/wsl.conf
  • Adding these two lines in the document:在文档中添加这两行:
[automount]
options="metadata,umask=0033" 
  • Saving the document by: pressing CTRL + X shortcut, then pressing Y , then Enter key to confirm the changes通过以下方式保存文档:按CTRL + X快捷键,然后按Y ,然后Enter键确认更改
  • Restarting my computer ( Very important for changes to take effect )重新启动我的计算机(对于更改生效非常重要

References:参考:

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM