react-speech-recognition icon indicating copy to clipboard operation
react-speech-recognition copied to clipboard

regeneratorRuntime is not defined

Open LeXuanNguyen opened this issue 3 years ago • 9 comments

This error is reported when I use the library on my project:

Uncaught ReferenceError: regeneratorRuntime is not defined

LeXuanNguyen avatar Jul 20 '21 04:07 LeXuanNguyen

I have the same issue when I use in my typescript project

amirzenoozi avatar Jul 25 '21 12:07 amirzenoozi

Hi @LeXuanNguyen @amirzenoozi Check out this. Let me know if that helps.

JamesBrill avatar Jul 25 '21 13:07 JamesBrill

@JamesBrill I Check That Link and It's Work But Only In Chrome Browser. You Didn't Support Other Browsers ? and the other issue is we don't have browserSupportsSpeechRecognition in useSpeechRecognition() What Should I Do About This? ( I think It's Related To @types Package)

amirzenoozi avatar Jul 25 '21 14:07 amirzenoozi

@amirzenoozi Do you mean that after installing and importing regenerator-runtime, you still see regeneratorRuntime is not defined in browsers other than Chrome? Or do you mean that speech recognition functionality does not work outside of Chrome? The latter is largely true due to the limited support for the Web Speech API in many browsers (see supported browsers). Your options are to either use browserSupportsSpeechRecognition to turn off your voice-driven feature on unsupported browsers, or to use a polyfill.

Regarding browserSupportsSpeechRecognition, perhaps you can share some code or a link to your repo in a separate GitHub issue so I can better understand the problem. This boolean property is returned as state from the useSpeechRecognition hook and should reflect the support for speech recognition in the browser.

JamesBrill avatar Jul 25 '21 17:07 JamesBrill

i had this issue in all of the browsers. app.js:1304 Uncaught ReferenceError: regeneratorRuntime is not defined at eval (RecognitionManager.js:219) at eval (RecognitionManager.js:290) at eval (RecognitionManager.js:385) at Object.../node_modules/react-speech-recognition/lib/RecognitionManager.js (app.js:793) at webpack_require (app.js:1301) at fn (app.js:1512) at eval (SpeechRecognition.js:16) at Object.../node_modules/react-speech-recognition/lib/SpeechRecognition.js (app.js:804) at webpack_require (app.js:1301) at fn (app.js:1512)

rafaelsouzagomes avatar Sep 24 '21 02:09 rafaelsouzagomes

Same here

mariuszbeltowski avatar Oct 11 '21 13:10 mariuszbeltowski

Hi @rafaelsouzagomes @mariuszbeltowski have you tried this?

JamesBrill avatar Oct 18 '21 18:10 JamesBrill

Hi @rafaelsouzagomes @mariuszbeltowski have you tried this?

This solved my problem

lnfernandobr avatar Oct 25 '21 16:10 lnfernandobr

I am getting this error running jest but browser is running fine, is fixed by adding import 'regenerator-runtime' at the top of files importing SpeechRecognition

prescottbreeden avatar Jan 27 '22 00:01 prescottbreeden

Thankyou so much , it works fine now !!

naveenbasyal avatar Jan 28 '23 12:01 naveenbasyal

Hi @rafaelsouzagomes @mariuszbeltowski have you tried this?

This solved my problem

I also have a problem. But not able to solve.

vitorrsousaa avatar Mar 16 '23 11:03 vitorrsousaa

Hi @rafaelsouzagomes @mariuszbeltowski have you tried this?

this did not work

Robertishimwe avatar Apr 07 '23 22:04 Robertishimwe

Hi @rafaelsouzagomes @mariuszbeltowski have you tried this?

Not working for me

Mizan-Rifat avatar Sep 06 '23 15:09 Mizan-Rifat

I am getting this error running jest but browser is running fine, is fixed by adding import 'regenerator-runtime' at the top of files importing SpeechRecognition

Still not working

priyanshusaini105 avatar Sep 09 '23 18:09 priyanshusaini105

Hi @LeXuanNguyen @amirzenoozi Check out this. Let me know if that helps.

Yes this works thanks a lot.

Osama3576 avatar Sep 17 '23 15:09 Osama3576

FYI! You need to include the import 'regenerator-runtime/runtime' at the top of the page.tsx file/s where you are using the library. In my case, it was at the top of the page.tsx of a nested tree. It did not work for me when I added it at the top of the root layout or at the root page.tsx. I'm using NextJS 13 App Dir tree

jsandlerus avatar Oct 04 '23 05:10 jsandlerus

import 'regenerator-runtime/runtime'

in my case i've already installed and importing regenerator-runtime, but still i can see regeneratorRuntime is not defined in every browsers including Chrome.

anuragd-dataslush avatar Nov 29 '23 05:11 anuragd-dataslush

Can anyone let me know the reason behind the error, and what additions including this library to our environment is doing?

aadij7 avatar Jan 18 '24 12:01 aadij7

import "regenerator-runtime/runtime";

installing regenerator-runtime and adding this line at the top of the file solved my issue. Remember to add the import statement at the very first line of your file

Mizan-Rifat avatar Jan 18 '24 14:01 Mizan-Rifat

If you are using React make sure to add this [ import "regenerator-runtime/runtime"; ] at line 1 of " main.jsx" file OR If using Javascript add the above import statement at line 1 of " index.js" file OR If using Typescript add the above import statement at line 1 of " index.tsx" file

ManishaSwain8 avatar Feb 04 '24 21:02 ManishaSwain8