I run the command npm install --save multer
and I get this error:
npm ERR! Unexpected token } in JSON at position 178469 while parsing near '...} npm ERR! } npm ERR! } npm ERR! } npm ERR! } npm ERR! '
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\user\AppData\Roaming\npm-cache_logs\2019-08-21T16_46_22_370Z-debug.log
What do I have to do to fix this?
installation works
The cache is probably corrupted from a previous download. You must execute some of the cache commands
to clean it or you can also use
which will look for problems in the cache and solve them.
If that is not the cause then it is very possible that your network environment is blocking downloads from
npm
so you should check with your network administrator.There is another possibility that if you manually edit the
package.json
or thepackage-lock.json
and it produces invalid JSON while trying to update some dependency it will cause a similar error. The solution for this case is to thoroughly check thepackage.json
, remove the lock and reinstall all dependencies withnpm install
.