简体   繁体   English

使用 Firebase 在 CodeSandbox 上找不到/安装 babel 插件“proposal-decorators”

[英]Could not find/install babel plugin 'proposal-decorators' on CodeSandbox with Firebase

I'm trying to use Codesandbox in React project, but I'm stuck with error: Could not find/install babel plugin 'proposal-decorators': Cannot find plugin 'proposal-decorators' or 'babel-plugin-proposal-decorators'.我正在尝试在 React 项目中使用 Codesandbox,但我遇到了错误:无法找到/安装 babel 插件 'proposal-decorators':找不到插件 'proposal-decorators' 或 'babel-plugin-proposal-decorators' . Error happens when I adding firebase utility in the project.在项目中添加 firebase 实用程序时发生错误。 On my local machine everythings fine.在我的本地机器上一切都很好。 Here is my code: https://codesandbox.io/s/eloquent-sun-r1bcqv这是我的代码: https://codesandbox.io/s/eloquent-sun-r1bcqv

I tried to:我尝试过了:

  1. Install babel/plugin-proposal-decorators and add "@babel/plugin-proposal-decorators": "7.18.2" in dependencies of package.json安装 babel/plugin-proposal-decorators 并在 package.json 的依赖项中添加"@babel/plugin-proposal-decorators": "7.18.2"
  2. Install babel and add "babel": "6.23.0" in dependencies of package.json安装 babel 并在 package.json 的依赖项中添加"babel": "6.23.0"
  3. Create babel.confing.json file and add {"plugins": ["@babel/plugin-proposal-decorators"]} into that config创建 babel.confing.json 文件并将{"plugins": ["@babel/plugin-proposal-decorators"]}添加到该配置中

What cause the problem?什么原因导致问题? Why there is babel/plugin-proposal-decorators if I didn't add it?如果我没有添加,为什么会有 babel/plugin-proposal-decorators?

It's because of importing SVG as a ReactComponent.这是因为将 SVG 作为 ReactComponent 导入。 It can't be done in sandboxes.它不能在沙盒中完成。

Actually, I solved that problem by decreasing the version of实际上,我通过降低版本解决了这个问题

  1. react-scripts to 2.0.3反应脚本到 2.0.3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 firebase 函数 Puppeteer 找不到 Chromium GCP - firebase function Puppeteer Could not find Chromium GCP 找不到 com.google.firebase:firebase-messaging:16.0.8 - Could not find com.google.firebase:firebase-messaging:16.0.8 CocoaPods 找不到 pod“Firebase/CoreOnly”的兼容版本 - CocoaPods could not find compatible versions for pod "Firebase/CoreOnly" Android Studio 构建错误:Gradle - 找不到平台('com.google.firebase:firebase-bom:30.3.1') - Android Studio build error: Gradle - Could not find platform('com.google.firebase:firebase-bom:30.3.1') CocoaPods 找不到 pod“Firebase/Core”的兼容版本 | cloud_firestore,Flutter - CocoaPods could not find compatible versions for pod "Firebase/Core” | cloud_firestore, Flutter 未定义 Firebase 插件 (FCM) - Firebase Plugin(FCM) is not defined 无法安装 firebase 工具 - cannot install firebase tools 在 GKE 中安装 istio 时出错 = 服务器找不到请求的资源(发布 `gatewaies.networking.istio.io`) - Error install istio in GKE = the server could not find the requested resource (post `gatewaies.networking.istio.io`) 在 Windows 上安装 Kubectl 插件 - Install Kubectl Plugin on Windows 无法在反应中安装 firebase 使用 npm 安装 firebase / 纱线添加 ZBF12E1515C253C7D8C0352F - Unable to install firebase in react using npm install firebase / yarn add firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM