Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo bundle fails with dependancy resolution error #264

Closed
anilsamuel opened this issue Oct 30, 2020 · 13 comments
Closed

Expo bundle fails with dependancy resolution error #264

anilsamuel opened this issue Oct 30, 2020 · 13 comments
Assignees
Labels
in review Acknowledged and being looked at now

Comments

@anilsamuel
Copy link

Get the error below in expo; shall I open a new issue ?

Failed building JavaScript bundle.
The package at "node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/CertChecks.js" attempted to import the Node standard library module "url". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries

package.json below if that helps

{
  "dependencies": {
    "@expo-google-fonts/inter": "^0.1.0",
    "@expo/vector-icons": "^10.0.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.6",
    "@react-native-community/picker": "1.6.6",
    "@react-navigation/native": "^5.8.2",
    "expo": "^39.0.3",
    "expo-barcode-scanner": "~9.0.0",
    "expo-constants": "~9.2.0",
    "expo-image-picker": "~9.1.0",
    "expo-status-bar": "~1.0.2",
    "microsoft-cognitiveservices-speech-sdk": "^1.14.0",
    "react": "~16.13.0",
    "react-dom": "~16.13.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz",
    "react-native-camera": "^3.40.0",
    "react-native-elements": "^3.0.0-alpha.1",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-qrcode-svg": "^6.0.6",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.4",
    "react-native-screens": "~2.10.1",
    "react-native-size-matters": "^0.3.1",
    "react-native-svg": "12.1.0",
    "react-native-web": "^0.14.7",
    "react-navigation": "^4.4.3",
    "react-navigation-stack": "^2.10.0"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0"
  }
}
@anilsamuel
Copy link
Author

url, util and https packages were compalined about and was installed using yarn add for each of them and eventually bricked as below

Logs for your project will appear below. Press Ctrl+C to exit.
Installing Expo client on device
Opening exp://192.168.20.61:19000 on Pixel_3a_API_30_x86
Failed building JavaScript bundle.
The package at "node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/CertChecks.js" attempted to import the Node standard library module "url". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries
Installing Expo client on device
Opening exp://192.168.20.61:19000 on Pixel_3a_API_30_x86
Failed building JavaScript bundle.
The package at "node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/external/ocsp/ocsp/agent.js" attempted to import the Node standard library module "util". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries
Installing Expo client on device
Opening exp://192.168.20.61:19000 on Pixel_3a_API_30_x86
Failed building JavaScript bundle.
The package at "node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/external/ocsp/ocsp/agent.js" attempted to import the Node standard library module "http". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries
Installing Expo client on device
Opening exp://192.168.20.61:19000 on Pixel_3a_API_30_x86
Failed building JavaScript bundle.
While trying to resolve module `http` from file `/Users/anthos/projects/dev.azure.com/arcbs/TransmateMobile/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/external/ocsp/ocsp/agent.js`, the package `/Users/anthos/projects/dev.azure.com/arcbs/TransmateMobile/node_modules/http/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/anthos/projects/dev.azure.com/arcbs/TransmateMobile/node_modules/http/index`. Indeed, none of these files exist:

  * /Users/anthos/projects/dev.azure.com/arcbs/TransmateMobile/node_modules/http/index(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)
  * /Users/anthos/projects/dev.azure.com/arcbs/TransmateMobile/node_modules/http/index/index(.native|.android.expo.ts|.native.expo.ts|.expo.ts|.android.expo.tsx|.native.expo.tsx|.expo.tsx|.android.expo.js|.native.expo.js|.expo.js|.android.expo.jsx|.native.expo.jsx|.expo.jsx|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.wasm|.native.wasm|.wasm)

@BrianMouncer BrianMouncer added the in review Acknowledged and being looked at now label Dec 7, 2020
@glharper
Copy link
Member

glharper commented Dec 7, 2020

@anilsamuel We currently don't officially support react-native integration, but I'm wondering if adding specific dependencies in your project.json on 'node-url', 'node-https', and 'util' would help.

@anilsamuel
Copy link
Author

@glharper node-url not found by yarn or npm
npm ERR! 404 Not Found - GET https://registry.npmjs.org/node-url - Not found
and
error An unexpected error occurred: "https://registry.yarnpkg.com/node-url: Not found".

@glharper
Copy link
Member

glharper commented Dec 7, 2020

@anilsamuel Found this, may be what you're looking for: node libs react native

@anilsamuel
Copy link
Author

@glharper Please find my observations below

  1. added the deps using yarn add microsoft-cognitiveservices-speech-sdk node-libs-react-native
  2. error below during app startup on device
    The package at "node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/external/ocsp/ocsp/agent.js" attempted to import the Node standard library module "http". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries

@glharper
Copy link
Member

glharper commented Dec 7, 2020

@anilsamuel From the node-libs-react-native "Usage" section:
Usage with React Native Packager
Add a metro.config.js file in the root directory of your React Native project and set resolver.extraNodeModules:

// metro.config.js
module.exports = {
resolver: {
extraNodeModules: require('node-libs-react-native'),
},
};

Perhaps you could try that instead of yarn for node-libs-react-native?

@anilsamuel
Copy link
Author

After that change, I get error as below

Warning: The provided value 'ms-stream' is not a valid 'responseType'.

  • node_modules/react-native/Libraries/LogBox/LogBox.js:173:8 in registerError
  • node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
  • node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
  • node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
  • node_modules/fbjs/lib/warning.js:30:4 in printWarning
  • node_modules/fbjs/lib/warning.js:51:4 in
  • node_modules/react-native/Libraries/Network/XMLHttpRequest.js:187:13 in set__responseType
  • node_modules/stream-http/lib/capability.js:41:5 in checkTypeSupport
  • node_modules/stream-http/lib/capability.js:55:59 in
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/external/ocsp/ocsp.js:3:23 in
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/expo/AppEntry.js:3:0 in
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:201:44 in guardedLoadModule

Warning: The provided value 'moz-chunked-arraybuffer' is not a valid 'responseType'.

  • node_modules/react-native/Libraries/LogBox/LogBox.js:173:8 in registerError
  • node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
  • node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
  • node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
  • node_modules/fbjs/lib/warning.js:30:4 in printWarning
  • node_modules/fbjs/lib/warning.js:51:4 in
  • node_modules/react-native/Libraries/Network/XMLHttpRequest.js:187:13 in set__responseType
  • node_modules/stream-http/lib/capability.js:41:5 in checkTypeSupport
  • node_modules/stream-http/lib/capability.js:59:0 in
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/external/ocsp/ocsp.js:3:23 in
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/expo/AppEntry.js:3:0 in
  • node_modules/metro/src/lib/polyfills/require.js:321:11 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:201:44 in guardedLoadModule

ReferenceError: Can't find variable: Buffer

  • node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
  • node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
  • node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
  • node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
  • node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
  • node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
  • node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
  • node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
  • node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
  • node_modules/regenerator-runtime/runtime.js:293:29 in invoke
  • node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
  • node_modules/regenerator-runtime/runtime.js:154:27 in invoke
  • node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
  • node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
  • node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
  • node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
  • node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
  • node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
  • [native code]:null in flushedQueue
  • [native code]:null in invokeCallbackAndReturnFlushedQueue

Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.
  • node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
  • node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
  • node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
  • node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
  • node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
  • node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
  • node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
  • node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
  • node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
  • node_modules/regenerator-runtime/runtime.js:293:29 in invoke
  • node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
  • node_modules/regenerator-runtime/runtime.js:154:27 in invoke
  • node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
  • node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
  • node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
  • node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
  • node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
  • node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
  • node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
  • [native code]:null in flushedQueue
  • [native code]:null in invokeCallbackAndReturnFlushedQueue

@glharper
Copy link
Member

glharper commented Dec 8, 2020

@anilsamuel We are still in the Proof-of-Concept stage for React support, and React-Native seems like a step beyond. Would you like us to ping you when we add React-Native support?

@anilsamuel
Copy link
Author

Please keep me posted, it would highly valuable for some innovative work we are looking forward for

@nwabdou85
Copy link

@glharper after one year from this, do you support React-native or still not supporting it ?

@dargilco
Copy link
Member

dargilco commented Feb 3, 2022

Hi @nwabdou85, @glharper is on vacation. I know he has been working on this repo. Is this what you are looking for?
https://github.com/glharper/cognitive-js-sdk-react-native

@nwabdou85
Copy link

@dargilco Thanks for your time; I want to implement speech to text feature , I don't know if with this sdk we can do it!!

@nwabdou85
Copy link

@dargilco can you help here please ? glharper/cognitive-js-sdk-react-native#2

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Acknowledged and being looked at now
Projects
None yet
Development

No branches or pull requests

5 participants