英文:
How to fix "Insecure world writable dir /mnt/c in PATH, mode 040777" error after running "rails s"
问题
我尝试更改权限,但仍然无法正常工作。我创建了一个新的Rails应用程序来测试它,但当我尝试启动Rails服务器时,出现了相同的错误。
当我在应用程序文件夹中运行 rails -v
时,我也收到相同的错误消息。
如何修复这个问题?
rails s
输出:
/usr/lib/ruby/vendor_ruby/rails/app_rails_loader.rb:39: 警告: 在 PATH 中存在不安全的可写目录 /mnt/c,模式为 040777
/usr/bin/ruby2.5: 警告: shebang 行以 \r 结尾可能会引发问题
忽略 executable-hooks-1.6.0,因为其扩展未构建。请尝试:gem pristine executable-hooks --version 1.6.0
忽略 gem-wrappers-1.4.0,因为其扩展未构建。请尝试:gem pristine gem-wrappers --version 1.4.0
忽略 nio4r-2.5.2,因为其扩展未构建。请尝试:gem pristine nio4r --version 2.5.2
忽略 nokogiri-1.10.7,因为其扩展未构建。请尝试:gem pristine nokogiri --version 1.10.7
忽略 websocket-driver-0.7.1,因为其扩展未构建。请尝试:gem pristine websocket-driver --version 0.7.1
回溯(最近的调用最后):
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': 无法加载文件 bundler(LoadError)
我的 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
# 在代码中的任何地方调用 'byebug' 以停止执行并获取调试器控制台
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
输出:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
rvm list
输出:
=* ruby-2.6.5 [ x86_64 ]
# => - current
# =* - current && default
# * - default
gem -v
输出:
3.1.2
ruby -v
输出:
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
英文:
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.
And I get the same error when I run rails -v
in the application folder.
How do I fix this?
rails s
output:
/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:
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:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
rvm list
output:
=* ruby-2.6.5 [ x86_64 ]
# => - current
# =* - current && default
# * - default
gem -v
output:
3.1.2
ruby -v
output:
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
答案1
得分: 3
I faced this issue on Windows 10 WSL, Ubuntu 18.04, and I solved it by:
- Opening or initializing
wsl.conf
file under the/etc
folder like this: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 pressingY
, thenEnter
key to confirm the changes - Restarting my computer (Very important for changes to take effect)
References:
- Microsoft Dev Blog: Automatically Configuring WSL
- Github - Microsoft/WSL: warning: Insecure world writable dir /mnt/c in PATH, mode 040777 #1426
英文:
I faced this issue on Windows 10 WSL, Ubuntu 18.04, and I solved it by:
- Opening or initializing
wsl.conf
file under the/etc
folder like this: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 pressingY
, thenEnter
key to confirm the changes - Restarting my computer (Very important for changes to take effect)
References:
答案2
得分: 2
你是否在使用WSL?
由于C驱动器(/mnt/c
)是Windows分区,它不与Ubuntu(Linux)共享文件/目录权限系统。
来自WSL的“警告:PATH中的不安全可写目录/mnt/c,模式040777#1426”可能会有用。
英文:
Are you using WSL?
Since C drive (/mnt/c
) is a Windows partition it doesn't share the file/dir permission system from Ubuntu(Linux).
"warning: Insecure world writable dir /mnt/c in PATH, mode 040777 #1426" from WSL can be useful.
答案3
得分: 1
我在 macOS 上使用 Cocoapods 时遇到了这个问题。运行 sudo chmod 755 /your/directory
命令帮助我解决了这个问题。希望对你也有帮助。
英文:
I encountered this on macOS while I was doing things with Cocoapods
. sudo chmod 755 /your/directory
helped me get rid of this issue. Hope it can work for you.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论