8

I am using react native and Expo. I am unable to build new app because after I use expo init appName it shows the following error. Heres the full message:

📦 Using npm to install packages. You can pass --yarn to use Yarn instead.

√ Downloaded and extracted project files.
× Something when wrong installing JavaScript dependencies. Check your npm logs. Continuing to initialize the app.

✅ Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

- cd Scanner
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios # requires an iOS device or macOS for access to an iOS simulator
- npm run web

I tried multiple times to create a blank project, also tried npm install to install failed/not downloaded libraries and continue after failure but it showed another error:

npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file

also tried npm cache verify that showed cache is ok Content verified: 3562 (252580364 bytes).

So, How can I solve this issue?

8
  • have you tried to reinstall npm and expo with npm install -g npm && npm install -g expo-cli. Then delete project and try again. Can also try run npm doctor and expo doctor. Commented Jun 28, 2020 at 19:15
  • I have used npm install -g npm && npm install -g expo-cli reinstalled and created new app but the issue persisted. Commented Jun 28, 2020 at 19:34
  • and did you try run npm doctor and expo doctor Commented Jun 28, 2020 at 19:39
  • using npm doctor shows node -v v12.13.1 Use node v12.18.1 in red all other message in white color and using expo doctor shows this error: Error: could not load config json at G:\Work\React Native\Scanner: ConfigError: Cannot determine which native SDK version your project uses because the module expo` is not installed. Please install it with yarn add expo and try again.` Although expo is installed and can create app with titled issue. Commented Jun 28, 2020 at 19:58
  • Did you try npm i expo instead of globally and have you tried on your C drive instead of G? Commented Jun 28, 2020 at 20:12

9 Answers 9

10

Problems related to npm installation are very common If you do any mistake in early installation, but is avoided. Learn more about npm tree.

Steps worked for me are :

  1. npm cache clean --force

  2. npm cache verify

  3. npm -g uninstall expo-cli --save

  4. npm install expo-cli --global

  5. expo init app-name

  6. cd app-name

  7. npm start

Always run as administrator if working on Windows and in root directory.

Sign up to request clarification or add additional context in comments.

Comments

3

The solutions above didn't work for me but if you use 'npm install' in the directory of the app you get a clue that you shuold try 'npm install --force' err message

You should have all these files folders and files at the start of the project otherwise not all the dependencies have been installed which is why we were getting the problem.folder structure

After you have added --force to npm install you have all the dependencies installed. Now you can run the app with npm start.

Comments

1

Unfortunately, all the solutions described above didn't work on my machine... Here is my latest solution for this problem... This worked 100% on my machine... Use npm i -g expo-cli This will automatically add the required packages and also remove the unnecessary ones. Yes, surely, you don't need to uninstall and re-install it again. Just follow my steps. And, you can create your expo project using expo init. I hope my solution will help you out from this annoying problem....

Comments

1

I just did npm install and it worked for me, but I had do that every time I create a new expo project.

Comments

0

I also encountered this problem, and finally found that it was the problem of react native cli,I installed the latest version of react native cli,Expo is back to normal

Comments

0

This Error is regarding to the git account. expos need a git account to setup react native project

If you are using windows you need to install git in your local PC after that open your Terminal and type this command

git config --global user.name "your_username"

git config --global user.email "[email protected]"

after that clone any github project to your local computer. it will ask to login to Github

after all these steps try expo init <projectname>

Comments

0

The simple way to settle that error is by using "expo-cli init app-name" instead of "expo init app-name".

I tried and worked perfectly for me. Hope it will help you guys.

Comments

0

i have faced a similar problem and running yarn set version 1.22.1 fix it

Comments

0

Run the Command Prompt as an administrator. And run the following command:

npx create-expo-app AwesomeProject

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.