title: R Unable to Install Packages From GitHub (System Error 267 @win/processx.c:1040)
body: <h3 id="tldr-akgo">TL;DR</h3>
  <blockquote>
  <p>Unable to install <strong>any</strong> package from GitHub, System Error 267</p>
  </blockquote>
  <p>I've newly setup R (v4.1), Rstudio and just installed devtools.
  I also additionally installed <a href="https://cran.r-project.org/bin/windows/Rtools/" rel="nofollow noreferrer">Rtools40</a> and added it to my path (global environment)</p>
  <p>Rtools seems to work properly as validated with: <code>Sys.which(&quot;make&quot;)</code> &amp; <code>maketools::rtools_find()</code> (output below)</p>
  <h1 id="problem-zlyt">Problem</h1>
  <p>I am unable to install <strong>any</strong> package from GitHub, e.g. <a href="https://github.com/rstudio/gt" rel="nofollow noreferrer">rstudio/gt</a>. The error is nearly identical for any GitHub Package, allways stating <code>system error 267</code></p>
  <pre><code>devtools::install_github(&quot;rstudio/gt&quot;)
  Downloading GitHub repo rstudio/gt@HEAD
  Error: Failed to install 'gt' from GitHub:
    create process 'C:/PROGRA~1/R/R-41~1.0/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
  ) @win/processx.c:1040 (processx_exec
  </code></pre>
  <h3 id="update-1oh5">Update</h3>
  <p>As suggested I reinstalled R 4.1.0 to the most simple folde possible <code>C:/R/</code>
  The error ist still the same despite now lacking tildes <code>~</code></p>
  <pre><code>devtools::install_github(&quot;rstudio/gt&quot;)
  Downloading GitHub repo rstudio/gt@HEAD
  Error: Failed to install 'gt' from GitHub:
    create process 'C:/R/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
  ) @win/processx.c:1040 (processx_exec)
  </code></pre>
  <h3 id="update-2-ns9a">Update 2:</h3>
  <p>Changed the .libPaths to a folder without any special characters</p>
  <pre><code>.libPaths( c( &quot;D:/tmp&quot; , .libPaths() ) )
  .libPaths()
  [1] &quot;D:/tmp&quot;                                     &quot;C:/Users/Björn/Documents/R/win-library/4.1&quot;
  [3] &quot;C:/R/library&quot;  
  
  Error is still the same
  </code></pre>
  <h3 id="update-3-dre3">Update 3:</h3>
  <p>I updated some packages, and checked the version of <code>packageVersion('processx')</code>= 3.5.2</p>
  <pre><code>install.packages(&quot;testthat&quot;) 
  install.packages(&quot;pkgload&quot;) 
  install.packages(&quot;devtools&quot;) 
  install.packages(&quot;remote&quot;)
  </code></pre>
  <p>Content of Sys.getenv</p>
  <pre><code> Sys.getenv('Path')
  [1] &quot;C:\\rtools40\\usr\\bin;C:\\R\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;
  </code></pre>
  <h1 id="diagnostics-afg8">Diagnostics</h1>
  <h3 id="session-info-u1hp">Session Info</h3>
  <pre><code>&gt; sessionInfo()
  R version 4.1.0 (2021-05-18)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows 10 x64 (build 19042)
  
  Matrix products: default
  
  locale:
  [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
  [4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base
  </code></pre>
  <h3 id="rtools-successful-installed-setup-1jlo">Rtools successful installed / setup</h3>
  <pre><code>Sys.which(&quot;make&quot;)
                                make 
  &quot;C:\\rtools40\\usr\\bin\\make.exe&quot; 
  
  maketools::rtools_find()
  $version
  [1] ‘4.0’
  
  $compiler
  [1] &quot;gcc 8.3.0&quot;
  
  $api
  [1] ‘8’
  
  $PATH
  [1] &quot;C:\\rtools40\\usr\\bin&quot;
  
  $BINPREF
  [1] &quot;C:/rtools40/mingw$(WIN)/bin/&quot;
  
  $available
  [1] TRUE
  
  $compatible
  [1] TRUE   
  </code></pre>