So I'm having trouble initializing expo project, everything works, I'm using nvm
at node v14.16.1 (npm v7.11.2)
.
expo init Doorgy
✔ Choose a template: › minimal bare and minimal, just the essentials to get you started
✖ Something went wrong in downloading and extracting the project files.
Invalid response body while trying to fetch https://registry.npmjs.org/expo-template-bare-minimum: EACCES: permission denied, open '/home/anthonykung/.expo/template-cache/tmp/0d1e04ab'
FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/expo-template-bare-minimum: EACCES: permission denied, open '/home/anthonykung/.expo/template-cache/tmp/0d1e04ab'
at /home/anthonykung/.npm-global/lib/node_modules/expo-cli/node_modules/minipass-fetch/lib/body.js:162:15
at extractTemplateAppAsync (/home/anthonykung/.npm-global/lib/node_modules/expo-cli/src/utils/extractTemplateAppAsync.ts:118:3)
at extractAndPrepareTemplateAppAsync (/home/anthonykung/.npm-global/lib/node_modules/expo-cli/src/utils/extractTemplateAppAsync.ts:82:3)
at action (/home/anthonykung/.npm-global/lib/node_modules/expo-cli/src/commands/init.ts:270:19)
at Command.<anonymous> (/home/anthonykung/.npm-global/lib/node_modules/expo-cli/src/exp.ts:350:7)
It kept throwing me that error no matter what I did, I try fixing npm
, I tried fixing nvm
, using different versions, uninstalling, messing with registries, pretty much everything I can find but it just kept showing this annoying error...
Here's a very long list of what I did:
npm install -g npm@latest
npm install -g expo-cli
sudo npm install -g expo-cli
node -v
sudo apt-get update
npm cache verify
sudo expo init Doorgy
npm config set registry https://registry.npmjs.org/
vi ~/.npmrc
npm outdated -g
npm uninstall -g expo-cli
npm install -g expo-cli
expo init Doorgy
~/.npm-global
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
npm config delete prefix
expo init Doorgy
npm config set prefix $NVM_DIR/versions/node/v14.16.1
expo init Doorgy
npm config set prefix '~/.npm-global'
vi ~/.profile
source ~/.profile
npm i -g expo-cli
expo init Doorgy
nvm use default
npm i -g expo-cli
expo init Doorgy
npm config delete prefix
npm i -g expo-cli
npm cache verify
sudo npm i -g expo-cli
npm i -g expo-cli
expo init Doorgy
nvm use default
sudo npm i -g expo-cli
expo init Doorgy
npm cache clean
cd
ls
ls -al
cd dev/DoorgyApp/
expo init Doorgy
npx expo init Doorgy
sudo npm install --unsafe-perm -g expo-cli
expo init Doorgy
npm config set strict-ssl false
expo init Doorgy
npm config set strict-ssl true
npm uninstall expo-cli
npm uninstall -g expo-cli
nvm use default
cp ~/.npmrc ~/.old-npmrc
vi ~/.npmrc
expo init Doorgy
npm uninstall -g expo-cli
sudo npm uninstall -g expo-cli
And none of them works so I did something random and it works... see the answer below
I did everything out there including the followings:
npm cache verify
sudo npm install --unsafe-perm -g expo-cli
npm config set strict-ssl false
But they all didn't work so I decided to uninstall expo-cli and reinstall. So I do
npm uninstall -g expo-cli
To my surprise, it survived and I can still use expo init
, so I naturally add sudo to it and guess what it's still there. Now very frustrated I try to delete every place that it exists starting from my home directory.
rm -rf /home/anthonykung/.expo/
rm: cannot remove '/home/anthonykung/.expo/template-cache/index-v5/d6/46/41a4d65191fd14edff849b1a5474a12dec9a503a4065b3d9fcfc568a5a3d': Permission denied
rm: cannot remove '/home/anthonykung/.expo/template-cache/index-v5/70/6f/218f4428aaa14899cf226ad3dbf086f32f36d36b64c6e5c3423b10488c8e': Permission denied
rm: cannot remove '/home/anthonykung/.expo/template-cache/content-v2/sha512/6d/28/efad7e78f4322111b65ccfd0dbcf763fc05cf73cc83edd751dc168af2e09437205de510f66ac3bc3289aeee7bd594cd3a8a9661e76fcd2ff263fd8dc4d11': Permission denied
rm: cannot remove '/home/anthonykung/.expo/template-cache/content-v2/sha512/23/26/522f178834febb149d5f9085ab51a65d6c43cac596a90ac4234151594e5248f32c03efb71870cd71e355781bdb0a80907f8bcac53d31ca8c34ec0897167d': Permission denied
rm: cannot remove '/home/anthonykung/.expo/template-cache/tmp': Permission denied
sudo rm -rf /home/anthonykung/.expo/
But there something came to mind... Permission denied
that sounds like the error expo is yelling about! So I did expo init
again with high hope and...
✔ Choose a template: › minimal bare and minimal, just the essentials to get you started
✔ Downloaded and extracted project files.
📦 Using npm to install packages.
✔ Installed JavaScript dependencies.
✔ Skipped installing CocoaPods because operating system is not on macOS.
✅ Your project is ready!
To run your project, navigate to the directory and run one of the following npm commands.
- cd Doorgy
- npm run android
- npm run ios # you need to use macOS to build the iOS project - use managed workflow if you need to do iOS development without a Mac
- npm run web
💡 You can also open up the projects in the ios and android directories with their respective IDEs.
🚀 expo-updates (https://github.com/expo/expo/blob/master/packages/expo-updates/README.md) has been installed in your project. Before you do a release build, you'll need to configure a few values in Expo.plist and AndroidManifest.xml in order for updates to work.
IT WORKS!!! HOLY COW THAT WORKS!!!
Before I deleted it I check the permission and owner of the ~/.expo
directory and it shows the right permission with the right owner... It never occurred to me that something inside was broken and removing them works. I'm sure this is just a rare thing that almost never happened to anyone else (I've never encountered this until now so...) but if it does happen to somebody I hope this help 🙌