I used the install command for emailjs
npm install --save @emailjs/browser
and it was successfully installed. it did say in the terminal
71 vulnerabilities (13 low, 19 moderate, 36 high, 3 critical)
I am trying to import emailjs with the line
import emailjs from '@emailjs/browser';
with no reference to it and I geet the following error:
./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';
| };
I tried changin the file EmailJSResponseStatus.js to what it shows as it currently is this:
export class EmailJSResponseStatus {
constructor(httpResponse) {
this.status = httpResponse?.status || 0;
this.text = httpResponse?.responseText || 'Network Error';
}
}
which did not work. I also tried installing different versions, I don't understand what's wrong.
Any help would be appreciated.
If there are recommendations to go about getting emails setup from a contact form instead of this using reactjs I would also appreciate that assuming I won't be getting this to work.
CodePudding user response:
Looks like your node version doesn't know about optional chaining operator ?.
.
You must upgrade to a more recent version of node :)
CodePudding user response:
enter the node_modules folder of your project, look for the @emailjs/browser folder > es > models > EmailJSResponseStatus.js , comment all the code and copy
export class EmailJSResponseStatus {
constructor(httpResponse) {
this.status = httpResponse.status;
this.text = httpResponse.responseText;
}
}
that fix it