Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! Invalid response body while trying to fetch http://registry.npmjs.org/accepts: Integrity verification failed for sha

npm ERR! Invalid response body while trying to fetch http://registry.npmjs.org/accepts: Integrity verification failed for <some key i probably shouldn't share>

I get this error on my RPI4 (raspbian) when trying to install angular cli and express. I downgraded to npm 6.13.7 as advised in another thread but no success.

like image 667
anton broos Avatar asked Oct 11 '20 19:10

anton broos


People also ask

What are some common NPM install errors?

367 NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0' 1 failed to install with npm, invalid json response

How to use NPM err cache?

On the other hand, if you're debugging an issue with the installer, npm ERR! or race conditions that depend on the timing of writing to an empty npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a npm ERR! temporary cache instead of nuking the actual one. npm ERR! npm ERR!

Why am I getting the “failed to fetch from registry” error?

As I have found out in the past, there are quite a few reasons why you might get the "failed to fetch from registry" error, so here are a few ways to fix it. As you might have noticed from the error message above, the npm version being used is pretty old. In this example we were using Node v0.6.10 and npm v1.1.0-3.

What is error 367 NPM install error?

Linked 367 NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0' 1 failed to install with npm, invalid json response


2 Answers

Try clearing the cache and do a install again

npm cache clear --force

npm install

like image 50
Doodle_coder Avatar answered Oct 23 '22 23:10

Doodle_coder


npm cache verify
npm install

The above helped me.
See details in the output of npm cache clean command without --force key.
In my case it was

$ npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses.  As a result,
npm ERR! data extracted from the cache is guaranteed to be valid.  If you
npm ERR! want to make sure everything is consistent, use `npm cache verify`
npm ERR! instead.  Deleting the cache can only make npm go slower, and is
npm ERR! not likely to correct any problems you may be encountering!
npm ERR! 
npm ERR! On the other hand, if you're debugging an issue with the installer,
npm ERR! or race conditions that depend on the timing of writing to an empty
npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR! temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command
npm ERR! with --force.
like image 40
it3xl Avatar answered Oct 24 '22 01:10

it3xl