'AWS IoT in React native. "fs".existsSync is not a function
I'm trying to implement aws-iot-device-sdk in react native. As mentioned, i've followed below steps to do the setup.
- Install aws-sdk and aws-iot-device-sdk
npm install --save aws-sdk aws-iot-device-sdk
- Install RN nodeify
npm install --save-dev rn-nodeify
- Install dependencies with rn-nodeify
npx rn-nodeify --install "fs,util,path,tls,stream,buffer,global,process,events,url" --hack
- Add this line into scripts part in package.json file
"postinstall": "npx rn-nodeify --install 'fs,util,path,tls,stream,buffer,global,process,events,url' --hack"
- Install asyncstorage-down
npm install --save asyncstorage-down
- Import shim file into index.js
import './shim';
As soon as I'm trying to call AwsIot.device() by passing certificate and private key, i'm getting below error.
TypeError: _$$_REQUIRE(dependencyMap[2], "fs").existsSync is not a function. (In '$$_REQUIRE(dependencyMap[2], "fs").existsSync(options.caCert)', '$$_REQUIRE(_dependencyMap[2], "fs").existsSync' is undefined)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
