我运行了以下命令:
yarn add --dev @babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript
...并收到以下错误(减去NPM清单-有关“完整”错误,请参见HasteBin链接。堆栈溢出限制为30,000个字符,因此我无法将其全部粘贴到此处) :
/** 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)
*/
纱线版本:1.21.1
节点版本:12.13.0
操作系统:Windows 10 Pro 1909 Build 18363.535
答案 0 :(得分:1)
您正在运行的命令是:
yarn add --dev @babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript
但是您应该运行的命令是:
yarn add --dev babel-loader @babel/core @babel/preset-react @babel/preset-typescript typescript
这是因为该包被称为babel-loader
而不是@babel-loader
(不需要@
符号)