I am a bit lost with all the expo and expo-cli tools and their local/global versions.
I have an expo react native project using storybook with the current package.json
{
"version": "1.0.0",
"private": true,
"name": "rn-libraries",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"storybook-generate": "sb-rn-get-stories -js",
"storybook": "cross-env STORYBOOK_ENABLED='true' expo start",
"storybook:ios": "cross-env STORYBOOK_ENABLED='true' expo start --ios",
"storybook:android": "cross-env STORYBOOK_ENABLED='true' expo start --android"
},
"dependencies": {
"@babel/core": "^7.20.0",
"@expo/metro-runtime": "^3.2.1",
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/datetimepicker": "6.7.3",
"@react-native-community/slider": "4.4.2",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.10.1",
"@reduxjs/toolkit": "^2.2.6",
"@storybook/addon-ondevice-actions": "^7.6.20",
"@storybook/addon-ondevice-controls": "^7.6.20",
"@storybook/preview-api": "^8.2.6",
"@storybook/react": "^8.2.6",
"@storybook/react-native": "^7.6.20",
"babel-loader": "^9.1.3",
"cross-env": "^7.0.3",
"expo": "~48.0.21",
"expo-constants": "~14.2.1",
"metro": "^0.80.9",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.14",
"react-native-gesture-handler": "~2.9.0",
"react-native-paper": "^5.12.3",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-svg": "13.4.0",
"react-native-web": "~0.18.10",
"typescript": "^4.9.4",
"@types/react": "~18.0.27"
}
}
As far as I understood, if you run $ [npx expo install](https://docs.expo.dev/more/expo-cli/#install) <package-name>
the script finds the corresponding version of the package to install it on my project.
So I had declared the [email protected] on my package.json, and I installed the rest of the libs based on that version.
The issue started when I had to upgrade the expo to SDK 51, and I followed the docs. At some point the project stopped being able to create a working build.
I was getting this error instead:
So I tried to roll-back to the older package.json that worked before. I deleted the node_modules, package-lock.json and npm install the older versions of that project. However the error persisted. Even though I have the whole project configed as I used to have it in the past (it was working), now it doesn’t work.
Important to note that another developer with the “older” package.json ( I attached it bellow ), is able to make it run, whereas me with the same state/config of the project I cannot.
So I am wondering how did the upgrade of expo@51 affected my system? What is the point of having defined the expo version on package.json while it doesn’t work as expected?
The “older” package json that is working for another developer but not on my PC. (The older version has some incompatibilities, but still works to another developer)
{
"version": "1.0.0",
"private": true,
"name": "rn-libraries",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"storybook-generate": "sb-rn-get-stories -js",
"storybook": "cross-env STORYBOOK_ENABLED='true' expo start",
"storybook:ios": "cross-env STORYBOOK_ENABLED='true' expo start --ios",
"storybook:android": "cross-env STORYBOOK_ENABLED='true' expo start --android"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/datetimepicker": "^6.7.3",
"@react-native-community/slider": "4.4.2",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@storybook/addon-ondevice-actions": "^7.6.14",
"@storybook/addon-ondevice-controls": "^7.6.14",
"@storybook/preview-api": "^8.0.8",
"@storybook/react": "^8.0.8",
"@storybook/react-native": "^7.6.14",
"babel-loader": "^9.1.3",
"cross-env": "^7.0.3",
"metro": "^0.80.8",
"react-native-gesture-handler": "~2.9.0",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"typescript": "^4.6.3"
},
"peerDependencies": {
"@expo/metro-runtime": "^3.1.1",
"@expo/vector-icons": "^13.0.0",
"@reduxjs/toolkit": "^2.2.3",
"@types/react": "^18.2.25",
"expo": "~48.0.21",
"expo-constants": "~14.2.1",
"i18n-js": "^4.3.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.14",
"react-native-paper": "^5.12.3",
"react-native-svg": "13.4.0",
"react-native-web": "~0.18.10",
"react-redux": "^9.1.0"
},
"dependencies": {
"@react-native-picker/picker": "^2.7.7",
"react-native-phone-number-input": "^2.1.0"
}
}
I tried to roll-back using Git, to the version that the project could work. I was deleting the node_modules and package-lock.json, then npm install the configed libs. Still I was getting the error that started appearing when i first upgraded expo@51. In the meantime those versions are working to another developer that hasn’t upgraded expo yet.
I need help to understand why this error started appearing right after I tried to upgrade to expo@51 and how to resolve the error “Unable to resolve “storybook/internal/preview-api” from “node_modules@storybookpreview-apishim.mjs””