Error while installing React-Native app Could not parse JSON returned from "npm pack expo-template-blank --dry-run". expo-template-blank-45.0.3.tgz

Viewed 2371

Showing this Error while expo the app

Error downloading and extracting template package: Error: Could not parse JSON returned from "npm pack expo-template-blank --dry-run".
expo-template-blank-45.0.3.tgz

Error: Unexpected token e in JSON at position 0
× Something went wrong while downloading and extracting the template.

Can't read JSON file: G:\ReactNative\FoodApp\app.json
└─ Cause: Error: ENOENT: no such file or directory, open 'G:\ReactNative\FoodApp\app.json'
├─ readAsync C:\Users\lenovo\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\json-file\src\JsonFile.ts:158:13
├─ extractAndPrepareTemplateAppAsync C:\Users\lenovo\AppData\Roaming\npm\node_modules\expo-cli\src\commands\utils\extractTemplateAppAsync.ts:25:25
└─ actionAsync C:\Users\lenovo\AppData\Roaming\npm\node_modules\expo-cli\src\commands\initAsync.ts:287:19

Error downloading and extracting template package: Error: Could not parse JSON returned from "npm pack expo-template-blank --dry-run".

expo-template-blank-45.0.3.tgz

Error: Unexpected token e in JSON at position 0
× Something went wrong while downloading and extracting the template.

Can't read JSON file: G:\ReactNative\FoodApp\app.json

I am new to react native and don't know how to resolve this issue

5 Answers

I have the same problem as you. The problem is that your NPM is not in the right version, if you have node 16.#.# you need to put this comand npm install -g npm it will update your npm and it will work.

I had the same issue and turned out that I did not have the latest npm version. Try to run the following and then try again:

npm install npm@latest

Updating to npm didn't work for me.

I had to switch to the lastest version of Node LTS, being v16.15.1 for me.

How to switch:

  1. Install the latest Node version: nvm install --lts

  2. Switch to latest version: nvm use --lts

My OS is Xubuntu running as a VM.

Updating to npm didn't work for me too.

I had to install the newest version of node, however I on Windows, so I just download the .msi node installer on NodeJs website, uninstall the expo-cli and install it again with node and npm on their last version.

just update npm version latest, i upgrade my npm version, work for me

Related