현상 발생원인
TypeError: cli.init is not a function at .......Node.js v18.16.0
이렇게만 뜨고 에러로 뜬것처럼 보인다.
이걸 해결하기 위한 과정을 적어본다.
npm uninstall -g react-native-cli npm install -g react-native npm install -g react-native-cli
--> 이 오류는 react-native의 버전이 안맞아서 일어날 수 있다는 오류 제보가있다.
javascript - TypeError: cli.init is not a function for react native - Stack Overflow
TypeError: cli.init is not a function for react native
While running npx react-native init appName in MacBook air M1 chip TypeError: cli.init is not a function at run (/opt/homebrew/lib/node_modules/react-native-cli/index.js:302:7) at createProject (/opt/
stackoverflow.com
우선 해본다.
npm ERR! code EEXIST npm ERR! path C:\Users\ressu\AppData\Roaming\npm\react-native npm ERR! EEXIST: file already exists npm ERR! File exists: C:\Users\ressu\AppData\Roaming\npm\react-native npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. npm ERR! A complete log of this run can be found in:
다음과 같은 에러가 났다..
문제는 이미 기존에 react-native 패키지가 존재해서 생기는 에러다.
그럼 다음과같이 force 업데이트를 통해서 해보자.
npm install --force react-native
저래도 잘 안되서 다음과같이 해봤다.
npm cache clean -f npm install -g stable
설치가 되고 나니 뭔가 될거같은 기분이 들었다.
해결~
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.