watson-developer-cloud / node-sdk

:comet: Node.js library to access IBM Watson services.
https://www.npmjs.com/package/ibm-watson
Apache License 2.0
1.48k stars 669 forks source link

Not working in react-native #1071

Closed defi-bear closed 3 years ago

defi-bear commented 3 years ago

I am trying to use ibm-watson and ibm-cloud-sdk-core in the react-native. My current versions: react: 16.11.0 react-native 0.62.2 ibm-watson: 5.7.1. ibm-cloud-sdk-core: 2.7.0

But it's not running the app and it's showing

error: Error: Unable to resolve module `module` from `node_modules/ibm-watson/node_modules/stack-utils/index.js`: module could not be found within the project.

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules: rm -rf node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
    at ModuleResolver.resolveDependency (/Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
    at ResolutionRequest.resolveDependency (/Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/node-haste/DependencyGraph.js:287:16)
    at Object.resolve (/Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/lib/transformHelpers.js:267:42)
    at /Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/DeltaBundler/traverseDependencies.js:434:31
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/DeltaBundler/traverseDependencies.js:431:18)
    at /Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/jy/Documents/Projects/React-Native/gabivoice/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)

Is there any way to fix this?

jeff-arn commented 3 years ago

@Shing-Ho apologies for the late reply, but I'm not certain what the specific issue is here unfortunately. It is possible that a dependency of the SDK is not compatible with the build environment required by React Native.

At this time we haven't done much testing for support of React Native. That is something that could change in the future, but your milage may vary when using React Native with the Node SDK.

apaparazzi0329 commented 3 years ago

Closing as wontfix. In the future, if this is a heavily requested feature, we may do more testing to ensure compatibility with React Native but for now results may vary.