0

I have a very stable internet connection but anytime i run the command npm install -g expo-cli i get the errors below.

I have no clue as to how to go about it, i guessed it was a network connection issue so i tried everything but still it isn't working

freduah@freduah:~$ npm install -g expo-cli npm ERR! code FETCH_ERROR npm ERR! errno FETCH_ERROR npm ERR! invalid json response body at https://registry.npmjs.org/expo-cli reason: Unexpected end of JSON input npm ERR! A complete log of this run can be found in: npm ERR! /home/freduah/.npm/_logs/2021-09-25T14_27_48_963Z-debug.log freduah@freduah:~$ 

After adding --loglevel verbose command the logs i received are below

freduah@freduah:~/ExpoTest$ npm install -g expo-cli --loglevel verbose npm verb cli [ npm verb cli '/usr/bin/node', npm verb cli '/usr/bin/npm', npm verb cli 'install', npm verb cli '-g', npm verb cli 'expo-cli', npm verb cli '--loglevel', npm verb cli 'verbose' npm verb cli ] npm info using [email protected] npm info using [email protected] npm timing config:load:defaults Completed in 2ms npm timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 2ms npm timing config:load:builtin Completed in 2ms npm timing config:load:cli Completed in 3ms npm timing config:load:env Completed in 1ms npm timing config:load:project Completed in 1ms npm timing config:load:file:/home/freduah/.npmrc Completed in 0ms npm timing config:load:user Completed in 0ms npm timing config:load:file:/etc/npmrc Completed in 0ms npm timing config:load:global Completed in 0ms npm timing config:load:cafile Completed in 0ms npm timing config:load:validate Completed in 1ms npm timing config:load:setUserAgent Completed in 0ms npm timing config:load:setEnvs Completed in 1ms npm timing config:load Completed in 11ms npm verb npm-session fbfdf28f750a4e2b npm timing npm:load Completed in 28ms npm timing arborist:ctor Completed in 1ms npm timing idealTree:init Completed in 11ms npm timing idealTree:userRequests Completed in 2ms npm http fetch GET 304 https://registry.npmjs.org/expo-cli 2711ms (from cache) npm timing idealTree:#root Completed in 2729ms npm timing idealTree:node_modules/expo-cli Completed in 0ms npm timing idealTree:buildDeps Completed in 2731ms npm timing idealTree:fixDepFlags Completed in 1ms npm timing idealTree Completed in 2749ms npm timing command:install Completed in 2775ms npm verb type invalid-json npm verb stack FetchError: invalid json response body at https://registry.npmjs.org/expo-cli reason: Unexpected end of JSON input npm verb stack at /usr/share/nodejs/npm/node_modules/minipass-fetch/lib/body.js:77:31 npm verb stack at processTicksAndRejections (internal/process/task_queues.js:97:5) npm verb stack at async Arborist.[nodeFromEdge] (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:874:19) npm verb stack at async Arborist.[buildDepStep] (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:824:11) npm verb stack at async Arborist.buildIdealTree (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:209:7) npm verb stack at async Arborist.reify (/usr/share/nodejs/@npmcli/arborist/lib/arborist/reify.js:127:5) npm verb stack at async install (/usr/share/nodejs/npm/lib/install.js:38:3) npm verb cwd /home/freduah/ExpoTest npm verb Linux 5.5.0-kali2-amd64 npm verb argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "expo-cli" "--loglevel" "verbose" npm verb node v12.21.0 npm verb npm v7.5.2 npm ERR! code FETCH_ERROR npm ERR! errno FETCH_ERROR npm ERR! invalid json response body at https://registry.npmjs.org/expo-cli reason: Unexpected end of JSON input npm verb exit 1 npm timing npm Completed in 3130ms npm ERR! A complete log of this run can be found in: npm ERR! /home/freduah/.npm/_logs/2021-09-25T14_45_02_470Z-debug.log freduah@freduah:~/ExpoTest$ 

After applying the solution provided by Aydin K The download procedures successfully continued but then, I encountered new problems, i was able to work around some and now i'm stuck at the error below

I got the error after running the command npm install -g expo-cli --loglevel verbose --legacy-peer-deps

pm verb type invalid-json npm verb stack FetchError: invalid json response body at https://registry.npmjs.org/react-dev-utils reason: Unexpected end of JSON input npm verb stack at /usr/share/nodejs/npm/node_modules/minipass-fetch/lib/body.js:77:31 npm verb stack at processTicksAndRejections (internal/process/task_queues.js:97:5) npm verb stack at async Promise.all (index 46) npm verb stack at async Arborist.[buildDepStep] (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:854:5) npm verb stack at async Arborist.buildIdealTree (/usr/share/nodejs/@npmcli/arborist/lib/arborist/build-ideal-tree.js:209:7) npm verb stack at async Arborist.reify (/usr/share/nodejs/@npmcli/arborist/lib/arborist/reify.js:127:5) npm verb stack at async install (/usr/share/nodejs/npm/lib/install.js:38:3) npm verb cwd /home/freduah/ExpoTest npm verb Linux 5.5.0-kali2-amd64 npm verb argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "expo-cli" "--loglevel" "verbose" "--force" "--legacy-peer-deps" npm verb node v12.21.0 npm verb npm v7.5.2 npm ERR! code FETCH_ERROR npm ERR! errno FETCH_ERROR npm ERR! invalid json response body at https://registry.npmjs.org/react-dev-utils reason: Unexpected end of JSON input npm verb exit 1 npm timing npm Completed in 194205ms npm ERR! A complete log of this run can be found in: npm ERR! /home/freduah/.npm/_logs/2021-09-25T17_18_03_855Z-debug.log freduah@freduah:~/ExpoTest$ 
6
  • Try increasing log level like described here to find out how the actual non-json response looks like : stackoverflow.com/questions/39412424/… Commented Sep 25, 2021 at 14:31
  • question updated with the logs Commented Sep 25, 2021 at 14:44
  • 1
    Here are some solutions: stackoverflow.com/questions/65039535/… Commented Sep 25, 2021 at 15:33
  • You’re welcome :-) Commented Sep 25, 2021 at 16:01
  • Hey Man. I've updated my question with the new error i'm facing. Would you mind taking a look ? Commented Sep 25, 2021 at 17:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.