Search
⌃K

React Native container cannot run

Enter in the terminal in the order below.

Update Node Version

rm -rf /usr/lib/node_modules
rm -rf /usr/bin/node
rm -rf /usr/include/node
rm -rf /usr/local/bin/node
rm -rf /usr/local/include/node
rm -rf /usr/share/man/man1/node*
rm -rf /usr/local/lib/node_modules/
rm -rf /usr/local/bin/npm
rm -rf ~/.npm
rm -rf ~/.node-gyp
apt remove nodejs -y
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

Edit package.json

Modify {{PORT}} to the value of external port corresponding to internal port 19000 in the top menu [CONTAINER] - [Port Forwarding Configuration].
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start --port {{PORT}}",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~48.0.10",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
"react-native": "0.71.6",
"react-native-web": "~0.18.10",
"react-dom": "18.2.0",
"@expo/webpack-config": "^18.0.1"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}

Install node_modules

npm i
npx expo install [email protected]~0.18.10 [email protected] @expo/[email protected]^18.0.1

Run React Native

Press the run button.