【问题标题】:Why am I getting this React EmailJS Error?为什么我会收到这个 React EmailJS 错误?
【发布时间】:2022-11-02 20:35:36
【问题描述】:

我使用了 emailjs 的安装命令

npm install --save @emailjs/browser

并成功安装。它确实在终端上说

71 vulnerabilities (13 low, 19 moderate, 36 high, 3 critical)

我正在尝试使用该行导入 emailjs

import emailjs from '@emailjs/browser';

没有参考它,我收到以下错误:

./node_modules/@emailjs/browser/es/models/EmailJSResponseStatus.js 4:29
Module parse failed: Unexpected token (4:29)
You may need an appropriate loader to handle this file type.
| export var EmailJSResponseStatus = function EmailJSResponseStatus(httpResponse) {
|   _classCallCheck(this, EmailJSResponseStatus);
>   this.status = httpResponse?.status || 0;
|   this.text = httpResponse?.responseText || 'Network Error';
| };

我尝试将文件 EmailJS Response Status.is 更改为它当前显示的内容:

export class EmailJSResponseStatus {
    constructor(httpResponse) {
        this.status = httpResponse?.status || 0;
        this.text = httpResponse?.responseText || 'Network Error';
    }
}

这没有用。我也尝试安装不同的版本,我不明白出了什么问题。

任何帮助,将不胜感激。

如果有建议从联系表单而不是使用 reactjs 获取电子邮件设置,我也将不胜感激,假设我不会让它工作。

【问题讨论】:

    标签: node.js reactjs email npm node-modules


    【解决方案1】:

    看起来您的节点版本不知道 optional chaining operator ?.

    你必须upgrade to a more recent version of node :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多