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

huangapple go评论88阅读模式
英文:

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 `&lt;main&gt;&#39;
            3: from bin/rails:3:in `load&#39;
            2: from /mnt/c/Users/max/Desktop/Dev/app_project/bin/spring:8:in `&lt;top (required)&gt;&#39;
            1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require&#39;
    /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require&#39;: cannot load such file -- bundler (LoadError)

My Gemfile:

source &#39;https://rubygems.org&#39;
git_source(:github) { |repo| &quot;https://github.com/#{repo}.git&quot; }

ruby &#39;2.6.5&#39;

gem &#39;rails&#39;, &#39;~&gt; 6.0.0&#39;
gem &#39;sqlite3&#39;, &#39;~&gt; 1.4&#39;
gem &#39;puma&#39;, &#39;~&gt; 3.11&#39;
gem &#39;sass-rails&#39;, &#39;~&gt; 5&#39;
gem &#39;webpacker&#39;, &#39;~&gt; 4.0&#39;
gem &#39;turbolinks&#39;, &#39;~&gt; 5&#39;
gem &#39;jbuilder&#39;, &#39;~&gt; 2.7&#39;


gem &#39;bootsnap&#39;, &#39;&gt;= 1.4.2&#39;, require: false

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

group :development do
  gem &#39;web-console&#39;, &#39;&gt;= 3.3.0&#39;
  gem &#39;listen&#39;, &#39;&gt;= 3.0.5&#39;, &#39;&lt; 3.2&#39;
  gem &#39;spring&#39;
  gem &#39;spring-watcher-listen&#39;, &#39;~&gt; 2.0.0&#39;
  gem &#39;better_errors&#39;, &#39;~&gt; 2.5&#39;, &#39;&gt;= 2.5.1&#39;
end

group :test do
  gem &#39;capybara&#39;, &#39;&gt;= 2.15&#39;
  gem &#39;selenium-webdriver&#39;
  gem &#39;webdrivers&#39;
end

gem &#39;tzinfo-data&#39;, platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem &#39;bootstrap&#39;, &#39;~&gt; 4.4.1&#39;

gem &#39;devise&#39;, &#39;~&gt; 4.7&#39;, &#39;&gt;= 4.7.1&#39;
gem &#39;jquery-rails&#39;
gem &#39;toastr-rails&#39;

gem &#39;omniauth&#39;, &#39;~&gt; 1.9&#39;

gem &#39;omniauth-facebook&#39;, &#39;~&gt; 5.0&#39;

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 ]

# =&gt; - current
# =* - current &amp;&amp; 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=&quot;metadata,umask=0033&quot; 
  • Saving the document by: pressing CTRL+X shortcut, then pressing Y, then Enter key to confirm the changes
  • Restarting my computer (Very important for changes to take effect)

References:

英文:

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=&quot;metadata,umask=0033&quot; 
  • Saving the document by: pressing CTRL+X shortcut, then pressing Y, then Enter 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.

huangapple
  • 本文由 发表于 2020年1月3日 22:11:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/59580024.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定