Cannot read properties of undefined

#이슈

React Native 홈페이지 환경세팅 안내에 따라서 환경세팅을 하고

npm start

를 실행해서 데모앱 실행을 시도할 때 아래와 같은 메세지가 나온다.

› Opening on iOS...
› Opening exp://172.30.1.43:19000 on iPhone 8
› Press ? │ show all commands
iOS Bundling failed 29ms
Cannot read properties of undefined (reading 'transformFile')

#해결책

  1. node_modules 삭제
  2. node 14.18.1 설치

node_modules 삭제 방법

sudo rm -rf ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.node_repl_history
sudo rm -rf /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp
sudo rm -rf /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm*
sudo rm -rf /usr/local/include/node /usr/local/include/node_modules
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d
sudo rm -rf /opt/local/include/node /opt/local/bin/node /opt/local/lib/node
sudo rm -rf /usr/local/share/doc/node
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp

brew uninstall node
brew doctor
brew cleanup --prune-prefix

node 14.18.1 설치

nvm install 14.18.1
nvm use 14.18.1

답글 남기기