Cannot import node-api module

オープン
#366 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ios, react-native, typescript
領域
mobile

調査の方向性

まず App.tsx、babel.config.js、requireNodeAddon エントリーポイントを使って再現を開始し、次に記載されている Expo prebuild と npm run ios の手順を実行して、iOS シミュレーターの読み込みエラーを再現します。完了の条件は、モジュール pshenmic-dpp が正常にインポートされ、サンプルアプリが dyld エラーなしで識別子とキーの値をレンダリングすることです。

索引モデルが issue の本文から書いたものです。

説明

Good day! I started preparing my module for release and encountered a problem during testing in React Native: I couldn't import the napi module either through require with babel.config.js or through requireNodeAddon.

Error:

[DEBUG] [NodeApiHost] [pshenmic-dpp--pshenmic_dpp] Loading addon by '@rpath/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp'
[DEBUG] [NodeApiHost] NapiHost: Failed to load library '@rpath/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp': dlopen(@rpath/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp, 0x0006): tried: '/Users/bebra/Library/Developer/Xcode/DerivedData/expopshenmicdpptest-fkfdlwyzamtrzididrrosigrycfm/Build/Products/Debug-iphonesimulator/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23C54/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/usr/lib/swift/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file, not in dyld cache), '/Users/bebra/Library/Developer/CoreSimulator/Devices/52938A97-D32A-46EB-A0BE-5D731586A09C/data/Containers/Bundle/Application/E542311F-D1B4-4181-B20E-9333E4A5E096/expopshenmicdpptest.app/Frameworks/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/Users/bebra/Library/Developer/CoreSimulator/Devices/52938A97-D32A-46EB-A0BE-5D731586A09C/data/Containers/Bundle/Application/E542311F-D1B4-4181-B20E-9333E4A5E096/expopshenmicdpptest.app/Frameworks/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/Users/bebra/Library/Developer/CoreSimulator/Devices/52938A97-D32A-46EB-A0BE-5D731586A09C/data/Containers/Bundle/Application/E542311F-D1B4-4181-B20E-9333E4A5E096/expopshenmicdpptest.app/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23C54/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/usr/lib/swift/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file, not in dyld cache), '/Users/bebra/Library/Developer/CoreSimulator/Devices/52938A97-D32A-46EB-A0BE-5D731586A09C/data/Containers/Bundle/Application/E542311F-D1B4-4181-B20E-9333E4A5E096/expopshenmicdpptest.app/Frameworks/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/Users/bebra/Library/Developer/CoreSimulator/Devices/52938A97-D32A-46EB-A0BE-5D731586A09C/data/Containers/Bundle/Application/E542311F-D1B4-4181-B20E-9333E4A5E096/expopshenmicdpptest.app/Frameworks/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_23C54/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 26.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/pshenmic-dpp--pshenmic_dpp.framework/pshenmic-dpp--pshenmic_dpp' (no such file)
[DEBUG] [NodeApiHost] [pshenmic-dpp--pshenmic_dpp] Failed to load library

Steps for reproduce

  1. create react native app
  2. add to dependencies:
"dash-platform-sdk": "https://github.com/pshenmic/dash-platform-sdk#a6687586eff35faa0a35409be7a97294640cf95f",
"react-native-node-api": "1.0.1"
  1. paste App.tsx
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, View } from 'react-native';
import {IdentifierWASM, IdentityPublicKeyWASM, Purpose, SecurityLevel, KeyType} from "pshenmic-dpp";

export default function App() {
  const keyId = 0
  const purpose = Purpose.DECRYPTION
  const securityLevel = SecurityLevel.HIGH
  const keyType = KeyType.ECDSA_SECP256K1
  const binaryData = '036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'

  const pubKey = new IdentityPublicKeyWASM(
    keyId,
    purpose,
    securityLevel,
    keyType,
    false,
    binaryData)

  const id = new IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')

  return (
    <View style={styles.container}>
      <Text>id base58: {id.base58()}</Text>
      <Text>id hex: {pubKey.keyType}</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
  1. run npx expo prebuild
  2. run npm run ios

This example use requireNodeAddon

I can't say that there might not be a mistake on my part somewhere here. I would appreciate any help.

主要言語
TypeScript
スター
188
フォーク
10
平均マージ
2日 17時間
マージ済み PR(30日)
3

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

callstackincubator/react-native-node-api のほかの issue

callstackincubator/react-native-node-api の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。