Hi @Alex Fang Greetings! Apologies for the delayed feedback on this.
I have investigated further into your use case. I would like to clarify that both azure-iothub
or azure/arm-iothub
are Node.js packages. They are dependent on Node.js. Please refer the link Azure SDK Node.js support to identify the minimum version needed to run the SDK. Further more, looking at the Azure React Native documentation Expo framework I found that it does not support Node.js by default. This is the reason why you are encountering these errors. Hope this answers your question.
I have come across this GitHub repository Azure IoT Starter Kit Companion which will help bridge the compatibility issues with React Native application and IoT SDK.
Here are couple few other possibilities you might consider to achieve what you are looking for:
- You can explore possibilities of Creating a Node.js and React app in Visual Studio and figure out how to combine the IoT Hub service SDK with the code. Please note that this approach lets you create a React application but not react native app.
- If mobile application is what you target and you are flexible to choose a different framework, this article How to use the Node.js SDK for Azure Mobile Apps would guide you with the steps needed to use Azure Node.js SDKs in a mobile application.
Hope this helps. Please let me know if you need any additional assistance or guidance on the above shared approaches.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.