The package at "node_modules\@google-cloud\speech\build\src\helpers.js" attempted to import the Node standard library module "stream"
When adding @google-cloud/speech to a fresh React Native project with Expo, I am unable to implement it.
Environment details
- OS: Windows 10
- Node.js version: v16.14.0
- npm version: 8.3.1
-
@google-cloud/speechversion: 4.10.2
Steps to reproduce:
- Create new project using
expo init - Install
@google-cloud/speechusingnpm install @google-cloud/speech - Error occurs when when using
const speech = require('@google-cloud/speech');
And what is the error? Please post the full stack trace.
@noahvstephenson Can you please provide a full stack trace, so we can assist you?
Still waiting for the full stack trace. Thank you team!
This is a Node.js library, we don't officially support other environments. It's expected that it won't work if Node.js modules are not available.
Having that said, the module might work in non-Node environments such as browser, but you might need to tweaks configs for webpack or whatever other bundler you use, if any, to ignore Node-specific things like stream. Note that you might need to pass {fallback: 'rest'} to the client constructor, and you might need to change the way how you authenticate. If you need help setting this up, please open a separate issue; we don't support this use case but can try to help make it work on a best effort basis.