1

I'm trying to write a transcription script in nodejs to deployed to google cloud function. here is the code

I am using node v17.5.0

const client = new speech.SpeechClient();

const [response] = await client.recognize(request);
const transcription = response.results

but I keep getting this error

160:30 error Parsing error: Unexpected token client

I have made multiple attempts including modifying .eslinrc.js file and still can't solve the problem.

what is causing this and how can i fix it?

e.iluf
  • 1,389
  • 5
  • 27
  • 69
  • What version of Node is involved? – Pointy Feb 14 '22 at 17:42
  • @Pointy node v17.5.0 – e.iluf Feb 14 '22 at 17:44
  • Did you try any of these? https://stackoverflow.com/questions/36001552/eslint-parsing-error-unexpected-token – GrafiCode Feb 14 '22 at 17:44
  • @GrafiCode that question is fairly old; Node 17 definitely supports `async/await`. – Pointy Feb 14 '22 at 17:49
  • @Pointy I don't know why you mention async/await, it is a fairly old question but it is about eslint and babel – GrafiCode Feb 14 '22 at 17:51
  • 1
    @GrafiCode ah, OK I didn't pick up on the fact that it's a lint problem and not a Node error. – Pointy Feb 14 '22 at 18:01
  • This error log is mostly caused by the ‘eslintrc’ file as you have already mentioned and discussed in stackoverflow.com/questions/ 53735009, 36001552, 67770785, 56035645, 48408143, 66416001, 66500682. But the error is also pointing at your “client” variable that is related to the [speech to text](https://cloud.google.com/nodejs/docs/reference/speech/latest/speech/v1.speechclient-class#_google_cloud_speech_v1_SpeechClient_recognize_member_1_) library. More details as your complete file or code would be very appreciated to provide more help as well as what you have tried so far. – Alex Feb 14 '22 at 23:51

0 Answers0