执行依赖重装后仍提示expo等依赖未安装的技术求助
exp start -c Hey there, let's troubleshoot those persistent dependency warnings you're seeing. Even after running full dependency resets, those warnings mean your project can't find expo, react-native, and react-native-render-html—here's how to fix it step by step:
1. Verify Your package.json Dependencies
First, double-check that your package.json actually lists these packages in its dependencies section. If they're missing, yarn has no reason to install them! Your dependencies should look something like this (adjust versions to match your project's compatibility):
"dependencies": { "expo": "^49.0.0", "react-native": "0.72.3", "react-native-render-html": "^6.3.4", // ... other project dependencies }
Add any missing packages to this section and save the file.
2. Re-Run Your Clean Install Command
With the updated package.json, execute your full cleanup and install sequence again:
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install
Keep an eye on the terminal output this time—you should see logs showing these three packages being downloaded and installed. If you get version mismatch errors, adjust the version numbers in package.json to match versions compatible with your Expo SDK version.
3. Clear Lock File Cache (If Needed)
Sometimes outdated lock files (yarn.lock) can prevent new dependencies from being installed properly. If you still don't see the packages after reinstalling:
- Back up your
yarn.lockfile - Delete the original
yarn.lock - Re-run
yarn install
This will generate a fresh lock file with your updated dependencies.
4. Ensure You're Running Commands in the Right Directory
Make sure you're executing exp start -c from your project's root directory (the same folder where package.json lives). If you're in a subfolder, exp won't be able to locate your installed dependencies.
5. Update expo-cli
Outdated expo-cli versions can sometimes cause detection issues. Update it globally with:
yarn global add expo-cli # Or if using npm: npm install -g expo-cli
Then try running exp start -c again.
内容的提问来源于stack exchange,提问作者Ethan Yan

