如何解决节点包的 mainBundlePath 为 Null
我正在使用 react-native-coreml 包并在启动时遇到此错误。
我的意图是使用这个包在我的本机应用程序中使用一个 CoreML 包。如果这有什么不同,我会在 EXPO 内运行它。
我什至无法运行该应用程序。这两个错误是一起的。
Unable to start your application. Please refer to https://expo.fyi/no-registered-application for more information.
和
TypeError: null is not an object (evaluating 'RNCoreML.mainBundlePath')
- node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
显然第一个错误没有用,只是为了彻底。
我的实现如下:
import React,{ useState } from 'react'
import { StyleSheet,Text,View } from 'react-native'
import FaceScanner from './FaceScanner';
import { classifyImage } from "react-native-coreml";
const Onboarding = () => {
const [imageURL,setImageURL] = useState('');
const [tested,setTested] = useState(false);
console.log(imageURL)
if (imageURL !== '' && !tested) {
async () => {
// const { label,confidence } = await classifyImage(imageURL,'./model.mlmodelc')
setTested(true);
console.log("The image is a " + label + ". I think. ")
}
}
...
edit 根据评论的建议,我已退出世博会。我现在遇到了这些错误。
BUNDLE ./index.js
ERROR TypeError: null is not an object (evaluating 'RNCoreML.mainBundlePath')
LOG Running "main" with {"rootTag":1,"initialProps":{}}
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running,stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
解决方法
react-native-coreml 是一个带有本机扩展的库,目前在博览会管理的工作流程中不起作用。 you can read about the managed workflow limitations in the expo docs。
如果你想使用它,运行 expo eject
并在 xcode 中构建项目
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。