Async-storage: Error Code 65

Created on 17 Jul 2019  路  12Comments  路  Source: react-native-async-storage/async-storage

Current behavior

Adding Async Storage to RN project produces error

Expected behavior

No error

Repro steps

Initialiaze new project with RN 0.59.10
react-native init --version 0.59.10 TestProject
pod init
yarn add @react-native-community/async-storage
react-native link @react-native-community/async-storage
pod install
react-native run-ios

Environment

"@react-native-community/async-storage": "^1.5.1"
"react": "16.8.3",
"react-native": "0.59.10"
-IOS

Error Code

info In file included from /Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.m:8:
/Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.h:8:9: fatal error: 'React/RCTBridgeModule.h' file not found

info #import <React/RCTBridgeModule.h>

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TestProject.xcworkspace

** BUILD FAILED **


The following commands produced analyzer issues:
    Analyze /Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/react-native/ReactCommon/jsi/jsi.cpp normal x86_64
    Analyze /Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal x86_64
    Analyze /Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
(3 commands with analyzer issues)

The following build commands failed:
    CompileC /Users/home/Desktop/APLIKACE/Test/TestProject/ios/build/TestProject/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNCAsyncStorage.build/Objects-normal/x86_64/RNCAsyncStorage.o /Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

package.json

{
  "name": "TestProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.5.1",
    "react": "16.8.3",
    "react-native": "0.59.10"
  },
  "devDependencies": {
    "@babel/core": "^7.5.4",
    "@babel/runtime": "^7.5.4",
    "babel-jest": "^24.8.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.55.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

PodFile

platform :ios, '9.0'

target 'TestProject' do
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

end

target 'TestProject-tvOS' do
  # Pods for TestProject-tvOS

  target 'TestProject-tvOSTests' do
    inherit! :search_paths
  end
end
bug iOS

Most helpful comment

@Krizzu

I am not sure if my repo would be of any help. The error can be reproduced in few minutes in completely new RN project, so reproducing the error might be probably faster.

Without pods the installation works fine and there are no issues using the package, but with pods it does not work. I have to use 0.59.10, since the production app is already using it and upgrading to 0.60 is not possible currently because of other packages.

Steps to repro:
1) react-native init async --version 0.59.10
2) cd async
3) cd ios
4) pod init
5) edit podfile to this

platform :ios, '9.0'

target 'async' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  # Pods for async

6) pod install
7) cd ..
8) yarn add @react-native-community/async-storage
9) react-native link @react-native-community/async-storage
10) cd ios
11) pod install
12) cd ...
13) react-native run-ios

Produces this error:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening async.xcworkspace
Metro bundler throw this error:

(node:41039) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/test7/async/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/test7/async/node_modules/react-native/package.json

Package.json

{
  "name": "async",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.1",
    "react": "16.8.3",
    "react-native": "0.59.10"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "babel-jest": "^24.8.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.55.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

I am not able to install the package in last 2 weeks and my production app is on hold because i need to get working the local storage. Any help on installing the package would be greatly appreciated. Thanks a lot.

All 12 comments

Can you please post the full build log? Error code 65 is a very generic failure and doesn't mean anything without the full context.

@tido64
Hi, i have looked through the log in detail and i think this is probably the issue:

info In file included from /Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.m:8:
/Users/home/Desktop/APLIKACE/Test/TestProject/node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.h:8:9: fatal error: 'React/RCTBridgeModule.h' file not found

info #import <React/RCTBridgeModule.h>

Can you post the content of your Podfile? I think you might be seeing this issue: https://github.com/react-native-community/async-storage/blob/LEGACY/docs/Troubleshooting.md#ios-fatal-error-reactrctbridgemoduleh-file-not-found

I still cant get it working even on new project. Tried to install several ways, manualy, use the troulbeshooting tips with no luck. I would like to use AsyncStorage for my project, so i would be grateful for any tip how to make it work on 0.59.10.
Its having errors in and empty project, so the repro takes 3 minutes to do.

Here is error log from Metro Bundler

```
Duplicate module name: react-native
Paths: /Users/home/Desktop/APLIKACE/RNTests/Test3/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/react-native/package.json

This error is caused by hasteImpl returning the same name for different files.
at setModule (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
at workerReply (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:37062) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:37062) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:37062) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
Paths: /Users/home/Desktop/APLIKACE/RNTests/Test3/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/react-native/package.json

This error is caused by hasteImpl returning the same name for different files.
at setModule (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
at workerReply (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:37062) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
```

This error comes from the Metro bundler now. It no longer has anything to do with Xcode or native code, so at least that's resolved.

Did you create a Metro config? Can you post your full configuration?

@tido64 Thanks for quick reply. This is content of my metro.config.js

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

I would suggest doing repro, its just an empty project with RN 0.59.10 using pods. I had to add the this to my podfile. The installation following the guide throws the 'React/RCTBridgeModule.h' file not found with both pods and manual linking.

  pod 'React', :path => '../node_modules/react-native'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

@LukePenkava Can you provide a repo with the issue you're having, so we could have a look?

@Krizzu

I am not sure if my repo would be of any help. The error can be reproduced in few minutes in completely new RN project, so reproducing the error might be probably faster.

Without pods the installation works fine and there are no issues using the package, but with pods it does not work. I have to use 0.59.10, since the production app is already using it and upgrading to 0.60 is not possible currently because of other packages.

Steps to repro:
1) react-native init async --version 0.59.10
2) cd async
3) cd ios
4) pod init
5) edit podfile to this

platform :ios, '9.0'

target 'async' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  # Pods for async

6) pod install
7) cd ..
8) yarn add @react-native-community/async-storage
9) react-native link @react-native-community/async-storage
10) cd ios
11) pod install
12) cd ...
13) react-native run-ios

Produces this error:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening async.xcworkspace
Metro bundler throw this error:

(node:41039) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/test7/async/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/test7/async/node_modules/react-native/package.json

Package.json

{
  "name": "async",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.1",
    "react": "16.8.3",
    "react-native": "0.59.10"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "babel-jest": "^24.8.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.55.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

I am not able to install the package in last 2 weeks and my production app is on hold because i need to get working the local storage. Any help on installing the package would be greatly appreciated. Thanks a lot.

Any movement on this? I am having the exact same issue.

@TimonSotiropoulos I have resolved the issue by following Krizzu suggestions here
https://github.com/react-native-community/async-storage/issues/91

@LukePenkava yeah I had a little look into it and could see that Pods was installing another version of react when I included this package (it must have it as a dependancy or something). Instead of following Krizzu's suggestion I just removed it from pods and linked the package manually.

Might still be worth looking into this issue unless it is resolved in the next react native release (I am also using 0.59.x at the moment and seems like 0.60.x is gonna be most recent version soon).

Either way thanks! :D

I'm going to close this one down. If you're still having the issue (and upgraded to React Native 0.60+) follow the steps:

  1. Clean project -> In Xcode, select Product -> Clean Build Folder
  2. Check how your Podfile looks like. Here's a link to the Podfile that you can check against yours. Please mind the target name, missing custom pods (handled by use_native_modules, and post_install script
  3. Run pod install in ios/ directory
Was this page helpful?
0 / 5 - 0 ratings

Related issues

loic-lopez picture loic-lopez  路  37Comments

sumanthyedoti picture sumanthyedoti  路  25Comments

dominiczaq picture dominiczaq  路  22Comments

Alaa-Ben picture Alaa-Ben  路  20Comments

josmithua picture josmithua  路  20Comments