Search code examples
node.jsyarnpkgelectron-forge

Yarn add command returns http 405


I ran this command:

yarn add --dev @babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript

...and got the following error (minus the NPM manifest - see HasteBin link for 'full' error. Stack Overflow limits to 30,000 characters so I was not able to paste it all here):

HasteBin Mirror of error

/** ERROR MINUS MANIFEST

Arguments: 
  C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js add --dev @babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript

PATH: 
  C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files\Java\jdk1.8.0_231\bin;C:\Program Files\AdoptOpenJDK\jdk-8.0.232.09-hotspot\bin;C:\Program Files\AdoptOpenJDK\jdk-11.0.5.10-hotspot\bin;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\NVIDIA Corporation\NVIDIA NvDLISR;C:\Gradle\gradle-5.6.3\bin;C:\ProgramData\chocolatey\bin;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\MongoDB\Server\4.2\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.2\bin;C:\Users\nycod\AppData\Local\Microsoft\WindowsApps;C:\Users\nycod\.dotnet\tools;C:\Users\nycod\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\speedtest-cli;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Yarn\bin\;C:\Users\nycod\AppData\Local\Microsoft\WindowsApps;C:\Users\nycod\AppData\Local\GitHubDesktop\bin;C:\Users\nycod\AppData\Roaming\npm;C:\Users\nycod\AppData\Local\Yarn\bin;C:\Users\nycod\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts;C:\Users\nycod\AppData\Local\Android\Sdk\platform-tools;C:\Users\nycod\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\nycod\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\nycod\AppData\Local\Programs\Microsoft VS Code\bin

Yarn version: 
  1.21.1

Node version: 
  12.13.0

Platform: 
  win32 x64

Trace: 
  Error: https://registry.yarnpkg.com/@babel-loader: Request "https://registry.yarnpkg.com/@babel-loader" returned a 405
      at Request.params.callback [as _callback] (C:\Program Files (x86)\Yarn\lib\cli.js:66065:18)
      at Request.self.callback (C:\Program Files (x86)\Yarn\lib\cli.js:140665:22)
      at Request.emit (events.js:210:5)
      at Request.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:141637:10)
      at Request.emit (events.js:210:5)
      at IncomingMessage.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:141559:12)
      at Object.onceWrapper (events.js:299:28)
      at IncomingMessage.emit (events.js:215:7)
      at endReadableNT (_stream_readable.js:1183:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)
*/

Yarn Version: 1.21.1

Node Version: 12.13.0

OS: Windows 10 Pro 1909 Build 18363.535


Solution

  • The command you are running is:

    yarn add --dev @babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript
    

    but the command you should be running is:

    yarn add --dev babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript
    

    This is because the package is called babel-loader not @babel-loader (no @ sign is needed)

    See here for more info