This repository was archived by the owner on Jan 18, 2024. It is now read-only.
How to downgrade all NPM packages to compatible versions after upgrading all dependencies? #4528
Unanswered
martin-braun
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Disclaimer: I also asked this question on the forum, because I don't know where I should rather ask the question.
I'm looking for a way to upgrade all NPM packages in one command, incl. major versions and updating the package.json. This should also upgrade expo using the CLI, but it should make sure that my packages stay compatible.
Simply running
expo-cli upgradeis not sufficient, because I might have other NPM packages that won't be upgraded in this step.I installed npm-check-updates to forcefully upgrade all packages (incl.
expo-cli) and update the contents of the package.json simultaneously. Then I try to upgrade expo in the hope that it downgrades all packages that are too high, again, but it does not.package.json
{ ... "scripts": { ... "upgrade": "npm-check-updates -u && expo-cli upgrade && shx rm package-lock.json && expo install" } ... }Running
npm run upgradecauses:This is, because
npm-check-updates -uwill upgradereactto18.2.0, although the current expo SDK supports on18.0.0.According to @brentvatne (ref) and @bsgbryan (ref)
expo-cli upgrade(formerlyexpo upgrade) should indeed downgrade my packages and it should update the contents of the package.json in that process, right?I know, that my script will most likely cause issues in my code. The command is not designed to run any now and then, but only to port the app to the most recent dependencies possible.
Here is my full package.json:
{ "name": "my-app", "version": "0.0.1", "main": "node_modules/expo/AppEntry.js", "scripts": { "pre": "shx cp -n .env.example .env", "start": "npm run pre && expo start && npm run post", "android": "npm run pre && expo start --android && npm run post", "ios": "npm run pre && expo start --ios && npm run post", "web": "npm run pre && cross-env NODE_OPTIONS=--openssl-legacy-provider expo start --web && npm run post", "post": "", "upgrade": "npm-check-updates -u && expo-cli upgrade && shx rm package-lock.json && expo install" }, "dependencies": { "@expo/webpack-config": "^0.17.0", "expo": "~46.0.8", "expo-status-bar": "~1.4.0", "react": "18.0.0", "react-dom": "18.0.0", "react-native": "0.69.4", "react-native-dotenv": "^3.3.1", "react-native-web": "~0.18.7" }, "devDependencies": { "@babel/core": "^7.12.9", "cross-env": "^7.0.3", "expo-cli": "^6.0.5", "npm-check-updates": "^16.0.5", "shx": "^0.3.4" }, "private": true }Beta Was this translation helpful? Give feedback.
All reactions