AppRegistry.registerComponent 호출 실패
다음을 사용하여 새 프로젝트를 만들었습니다.
react-native init Wevaha
하고 나서, 만, 때, ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★' Application Wevaha has not been registered.This is either due to a require() error during intialization or failure to call
AppRegistry.registerComponent'
아래 첨부된 스크린샷을 찾아주세요.
다른 앱에 대해 이미 다른 React Native 패키지 서버가 실행 중이거나 AppDelegate.m의 앱 이름과 index.js가 다를 수 있습니다.
창을 , 한 번.moduleName
프로젝트를 다시 실행할 수 있습니다.
우리에게는 등록된 앱의 이름이 루트 폴더와 일치하지 않는 것이 문제였습니다. 폴더가 " " " 인/ChatApp
앱을 등록합니다.
AppRegistry.registerComponent('ChatApp', () => App);
Oblador가 말한 것을 자세히 설명하자면, 터미널 창을 모두 닫은 후에도/다른 React Native 프로세스를 모두 종료한 후에도 여전히 이 문제가 발생하고 있었습니다.에게 일은 그였다.moduleName
AppDelegate.m
(XCode 프로젝트의 루트에 있음)이 올바르지 않습니다.바톤 해먼드의 Snowflake의 빌드를 사용하고 있는데, "Snowflake"에서 "Snowflake"로 이름을 바꾸려고 했는데 이 값을 놓쳐서 오류가 발생했습니다.
앱 에 발생합니다.index.ios.js
.
에서 변경 후 동작합니다.
AppRegistry.registerComponent('AppleReactNative', () => App)
로.
AppRegistry.registerComponent('applereactnative', () => App)
제 경우는, 리슨 하고 있는 패키지의 포토 번호를 확인합니다.이 전화한 npm start
이치노
┌────────────────────────────────────────────────────────────────────────────┐§ 포트 8081에서 패키지 실행 중││ │§ JS프로젝트를 개발하면서 이 패키지는 계속 가동합니다.필 »이 탭은 자유롭게 닫고 패키지 인스턴스를 실행할 수 있습니다.§ prefer.││ │https://github.com/facebook/react-native (영어)│ │└────────────────────────────────────────────────────────────────────────────┘
다음으로 어떤 애플리케이션이 그 포트에서 리슨하고 있는지 확인합니다.
lsof -i :8081
결과:
명령어 PID 사용자 FD형 디바이스 크기/오프 노드명AwesomePr 8131 haxpor 9u IPv6 0x372bdab8e928e839 0t0 TCP localhost:56484 -> localhost:sunproxyadmin (SYN_SENT)
자, 받아라PID
번호를 매겨서 강제로 죽인다.
kill -9 8131
캐시 리셋을 통해 이상적인 패키지 재실행npm start -- --reset-cache
이제 괜찮을 거야
참고:
반응:15.4.2
, 리액트 리액트 리액트 리액트 리액트 리액트:0.41.2
다른 노드 프로세스를 모두 종료하는 것이 효과가 있었습니다.
ps -ef | grep node
그런 과정을 찾아서
pkill -f node
프로세스를 종료하다
Android 장치 또는 Android 에뮬레이터에서 실행 중 이 문제가 발생할 경우,
index.js 이외의 앱 이름도 아래 파일과 같아야 합니다.index.android.bundle
:
다음 경로에서 찾을 수 있습니다.~android/app/src/main/assets/index.android.bundle
이전 앱 이름을 검색하여 실제 이름으로 바꿉니다.
저한테도 잘 먹혔어요. 다른 사람들도 도움이 됐으면 좋겠어요.
에 등록된 앱의 이름을 확인합니다.package.json
는 루트 폴더의 이름과 일치합니다.리액트 네이티브 앱에서는 다음과 같습니다.다음과 같이 ./app.json에서 appName(camelCase)으로 이름을 Import하십시오.
import React from 'react'
import {AppRegistry} from 'react-native';
import App from './app/index';
import {name as appName} from './app.json';
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, compose } from 'redux'
import promiseMiddleware from 'redux-promise'
import reducers from './app/store/reducers'
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const createStoreWithMiddleware = createStore(
reducers,
composeEnhancers(applyMiddleware(promiseMiddleware))
)
const appRedux = () => {
return(
<Provider store={createStoreWithMiddleware}>
<App />
</Provider>
)
}
AppRegistry.registerComponent(appName, () => appRedux);
그냥 뛰어요.
npx react-native-rename <newName> -b <bundleIdentifier>
또한 이 기능이 이 기능을 덮어쓰지 않습니다.ReactNativeFlipper.java
그래서 이름을 바꿔야 해요.
Android\app\src\display\com\oldprojname\React Native Flipper.java
로.
안드로이드\app\src\com\newprojname\com\React Native Flipper.java
and changed inside `ReactNativeFlipper.java`
-com.oldproname
+com.newprojname
app.json에서 변경해 주세요.
{ "name" : "newprojname", "displayName" : "newname" }
( ( appName , ( ) = > App )에서 작은 괄호를 제거합니다.
AppRegistry.registerComponent(appName, () => App);
소문자 알파벳으로 프로젝트 이름을 만들어 보십시오.
효과가 있었습니다. :)
예:
npx react-native init <projectname>
인android/app/src/main/java/com/myapp/MainActivity.java
, 변경:
@Override
protected String getMainComponentName() {
return "MyApp";
}
대상:
@Override
protected String getMainComponentName() {
return "main";
}
업그레이드 후에 직면했던 어플리케이션의 문제를 수정했습니다.Expo
/React Native
새로운 버전으로 업그레이드합니다.
언급URL : https://stackoverflow.com/questions/35449248/failure-to-call-appregistry-registercomponent
'programing' 카테고리의 다른 글
AngularJS는 컨트롤러로부터의 속성 접근을 지시합니다. (0) | 2023.02.27 |
---|---|
새 React 앱 생성 중 오류 발생("최신 릴리스(5.0.0)보다 늦은 'create-react-app' 4.0.3을 실행 중) (0) | 2023.02.27 |
스프링 부트 응용 프로그램의 기본 로깅 파일 (0) | 2023.02.27 |
JSON 중 구문 분석 오류를 무시합니다.NET 데이터 해석 (0) | 2023.02.27 |
각도 JS 및 방향 링크 및 $timeout (0) | 2023.02.27 |