oneclick / rubyinstaller2

MSYS2 based RubyInstaller for Windows
https://rubyinstaller.org
BSD 3-Clause "New" or "Revised" License
646 stars 248 forks source link

Gem permission denied in Windows #279

Closed Qutorcle closed 2 years ago

Qutorcle commented 2 years ago

How do I resolve this? It seems to be an issue with Ruby rather than Windows. Thanks for the help!

What problems are you experiencing?

I try to run the command "gem install shopify-cli" through a Windows command prompt (run as administrator). It produces the following output: Fetching nokogiri-1.13.4-x64-mingw-ucrt.gem Fetching parser-3.1.2.0.gem Fetching theme-check-1.10.2.gem Fetching ast-2.4.2.gem Fetching liquid-5.3.0.gem Fetching ffi-1.15.5-x64-mingw-ucrt.gem Fetching rb-inotify-0.10.1.gem Fetching rb-fsevent-0.11.1.gem Fetching listen-3.7.1.gem Fetching concurrent-ruby-1.1.10.gem Fetching bugsnag-6.24.2.gem Fetching shopify-cli-2.16.1.gem Successfully installed ast-2.4.2 Successfully installed parser-3.1.2.0 Successfully installed nokogiri-1.13.4-x64-mingw-ucrt Successfully installed liquid-5.3.0 Successfully installed theme-check-1.10.2 Successfully installed ffi-1.15.5-x64-mingw-ucrt Successfully installed rb-inotify-0.10.1 Successfully installed rb-fsevent-0.11.1 Successfully installed listen-3.7.1 Successfully installed concurrent-ruby-1.1.10 Successfully installed bugsnag-6.24.2 Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing shopify-cli: ERROR: Failed to build gem native extension.

current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.16.1/ext/shopify-extensions

C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/3.1.0 -r ./siteconf20220430-24284-jubbzv.rb extconf.rb

current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.16.1/ext/shopify-extensions C:\Program\ Files\ (x86)\GnuWin32\bin DESTDIR\= clean current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.16.1/ext/shopify-extensions C:\Program\ Files\ (x86)\GnuWin32\bin DESTDIR\= make failedPermission denied - C:\Program Files (x86)\GnuWin32\bin

Gem files will remain installed in C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.16.1 for inspection. Results logged to C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/shopify-cli-2.16.1/gem_make.out

Steps to reproduce

  1. Download Ruby x64 + devkit
  2. Run installation with default variables
  3. Restart the computer (or not, has no impact on this issue)
  4. Run command prompt as administrator
  5. Type "gem install shopify-cli"

What's the output from ridk version?

ruby: path: C:/Ruby31-x64 version: 3.1.2 platform: x64-mingw-ucrt ruby_installer: package_version: 3.1.2-1 git_commit: 17502f9 msys2: path: C:\Ruby31-x64\msys64 cc: gcc (Rev10, Built by MSYS2 project) 11.2.0 sh: GNU bash, version 5.1.16(1)-release (x86_64-pc-msys) os: Microsoft Windows [Version 10.0.22000.613]

Failed solutions

Messing with the bin folder permissions Reloading the computer Ruby reinstall Using Ruby x86 Messing with PATH

mohits commented 2 years ago

It's troublesome that running on Windows 10 x64 with Ruby 3.1.1, I had no problem with the installation :(

$ gem install shopify-cli
Fetching ast-2.4.2.gem
Fetching theme-check-1.10.2.gem
Fetching parser-3.1.2.0.gem
Fetching shopify-cli-2.16.1.gem
Fetching nokogiri-1.13.4-x64-mingw-ucrt.gem
Fetching liquid-5.3.0.gem
Fetching bugsnag-6.24.2.gem
Successfully installed ast-2.4.2
Successfully installed parser-3.1.2.0
Successfully installed nokogiri-1.13.4-x64-mingw-ucrt
Successfully installed liquid-5.3.0
Successfully installed theme-check-1.10.2
Successfully installed bugsnag-6.24.2
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed shopify-cli-2.16.1
Parsing documentation for ast-2.4.2
Installing ri documentation for ast-2.4.2
Parsing documentation for parser-3.1.2.0
Installing ri documentation for parser-3.1.2.0
Parsing documentation for nokogiri-1.13.4-x64-mingw-ucrt
Installing ri documentation for nokogiri-1.13.4-x64-mingw-ucrt
Parsing documentation for liquid-5.3.0
Installing ri documentation for liquid-5.3.0
Parsing documentation for theme-check-1.10.2
Installing ri documentation for theme-check-1.10.2
Parsing documentation for bugsnag-6.24.2
Installing ri documentation for bugsnag-6.24.2
Parsing documentation for shopify-cli-2.16.1
Installing ri documentation for shopify-cli-2.16.1
Done installing documentation for ast, parser, nokogiri, liquid, theme-check, bugsnag, shopify-cli after 49 seconds
7 gems installed

something seems off in your setup and that is likely causing this but you've done quite a bit that should have helped.

Could you please share the PATH that you see in your console? Just type path and see what it shows. It seems that somehow you're ending up having to contend with vC:\Program\ Files\ (x86)\GnuWin32\bin which is not normal when working with Ruby+DevKit installation.

MSP-Greg commented 2 years ago

Re GnuWin32, I'd suggest using software that is actively supported.

An example, looking at http://gnuwin32.sourceforge.net/packages.html, the OpenSSL version listed is 0.9.8h, which isn't supported by anything considered secure. I assume that software is conflicting with MSYS2 utilities, and you might consider removing from it from Path.

JFYI, shopify-cli installs on my system with Ruby master (my default Ruby, very similar to Ruby 3.1)

Qutorcle commented 2 years ago

It's troublesome that running on Windows 10 x64 with Ruby 3.1.1, I had no problem with the installation :(

$ gem install shopify-cli
Fetching ast-2.4.2.gem
Fetching theme-check-1.10.2.gem
Fetching parser-3.1.2.0.gem
Fetching shopify-cli-2.16.1.gem
Fetching nokogiri-1.13.4-x64-mingw-ucrt.gem
Fetching liquid-5.3.0.gem
Fetching bugsnag-6.24.2.gem
Successfully installed ast-2.4.2
Successfully installed parser-3.1.2.0
Successfully installed nokogiri-1.13.4-x64-mingw-ucrt
Successfully installed liquid-5.3.0
Successfully installed theme-check-1.10.2
Successfully installed bugsnag-6.24.2
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed shopify-cli-2.16.1
Parsing documentation for ast-2.4.2
Installing ri documentation for ast-2.4.2
Parsing documentation for parser-3.1.2.0
Installing ri documentation for parser-3.1.2.0
Parsing documentation for nokogiri-1.13.4-x64-mingw-ucrt
Installing ri documentation for nokogiri-1.13.4-x64-mingw-ucrt
Parsing documentation for liquid-5.3.0
Installing ri documentation for liquid-5.3.0
Parsing documentation for theme-check-1.10.2
Installing ri documentation for theme-check-1.10.2
Parsing documentation for bugsnag-6.24.2
Installing ri documentation for bugsnag-6.24.2
Parsing documentation for shopify-cli-2.16.1
Installing ri documentation for shopify-cli-2.16.1
Done installing documentation for ast, parser, nokogiri, liquid, theme-check, bugsnag, shopify-cli after 49 seconds
7 gems installed

something seems off in your setup and that is likely causing this but you've done quite a bit that should have helped.

Could you please share the PATH that you see in your console? Just type path and see what it shows. It seems that somehow you're ending up having to contend with vC:\Program\ Files\ (x86)\GnuWin32\bin which is not normal when working with Ruby+DevKit installation.

Hello, thanks for the feedback! Here is the path. [username] replaces my actual username

PATH= C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin; C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\libnvvp; C:\Python310\Scripts\; C:\Python310\; C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\; C:\Windows\System32\OpenSSH\; C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common; C:\Program Files\Git\cmd; C:\Program Files\dotnet\; D:\nodejs\; C:\ProgramData\chocolatey\bin; ; C:\Program Files\Docker\Docker\resources\bin; C:\ProgramData\DockerDesktop\version-bin; C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.1.1\; C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR; C:\Program Files\CMake\bin; C:\Ruby31-x64\bin; C:\Users\[username]\AppData\Local\Microsoft\WindowsApps; C:\Users\[username]\AppData\Roaming\npm; C:\Users\[username]\AppData\Local\Programs\Microsoft VS Code\bin

mohits commented 2 years ago

Did you install Ruby 3.1 + Devkit or just Ruby? In case of doubt, I'd recommend that first you install Ruby 3.1 + Devkit [detailed instructions here: https://notepad.onghu.com/2022/ruby3.1-windows-day0-install-hello_world/ in case you need it]

Then, if that alone doesn't solve it, set the path to a very minimal PATH, e.g.

PATH=C:\Ruby31-x64\bin;c:\Windows\System32

...and try again. Hopefully that helps.

Qutorcle commented 2 years ago

Thanks for the support! As it turned out, the problem was that (for a reason which will forever remain a mystery), I had a system variable "make" with C:\Program Files (x86)\GnuWin32\bin. Removing this variable solves the problem.

mohits commented 2 years ago

@Qutorcle - delighted to hear that, and thanks for coming back to close the issue. Happy that it works for you.