Cannot import node-api module

Abierto
#366 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
ios, react-native, typescript
Área
mobile

Línea de trabajo

Comienza con la reproducción en App.tsx, babel.config.js y el punto de entrada requireNodeAddon; después, ejecuta los pasos indicados Expo prebuild y npm run ios para reproducir el error de carga del simulador de iOS. Se considera terminado cuando el módulo pshenmic-dpp se importa correctamente y la aplicación de ejemplo renderiza los valores del identificador y de la clave sin el fallo de dyld.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
188
Forks
10
Merge medio
2 d 17 h
PR fusionados (30 d)
3

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de callstackincubator/react-native-node-api

Todos los issues de callstackincubator/react-native-node-api

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.