npm ERR! Unexpected end of JSON input while parsing near '...":{"shasum":"ae6c2edf' - npm

npm ERR! Unexpected end of JSON input while parsing near '...":{"shasum":"ae6c2edf'
getting this error while npm install.
Steps i had done
1. create a new project
2. done npm install
getting this error for all new projects.

Cleaning the corrupted local npm cache may fix this error.
npm cache clean --force
Just run your npm command again after executing the above command in your terminal.
There could be few other reasons for the invalid JSON, as described in the official documentation here.
The official npm website has well documented most of the common errors. But unfortunately they don’t appear on the top results when you google the error.

updating angular cli to latest worked for me.

Related

Error "Cannot read property "matches" of undefined" when using "npm install"

I'm trying to install expo globally on my Windows 10 machine for a school assignement.
As the doc says, I've been trying the following command in my terminal :
$ npm install --global expo-cli
but it always gives me the same error :
npm ERR! Cannot read property 'matches' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2021-04-07T13_43_16_562Z-debug.log
I've tried running $ npm install -g expo-cli instead but the same thing happens.
I haven't tried reinstalling node or anything yet because I need my pc up and running for this week and I'm not too accustomed to all that, I'd like to keep that a last resort if possible.
Has anyone ever encountered this error before ?
Thanks to those who replied but I "accidentally" fixed it myself.
Through my searching I ended up actually uninstalling node with $ nvm uninstall v15.0.0 and I found myself obligated to download it again here.
Must've been a problem with the version I was using as suggested before.
Try removing the node_modules folder and package-lock.json file and run command npm install.

How can i solve this vue related issue

Am trying to create a vue project using command line but it is showing this error message:
Error unexpected end ofJSON input while parsing near '....67e12ef","tarball":"h'
Using command line, I created a new project in C directory after which, I installed vue using NPM. After that I try installing #vue/CLI globally using NPM but while installing it the above error sprout out.
Have done npm cache clean --force but still the same error..
It is hard to suggest anything because your question lacks details.
However this error often appears as a problem with npm itself.
Consider cleaning npm's cache with following commands:
npm cache clean --force
npm cache verify
If the problem will still occur, please provide more details.

How do I install react and react-redux onto my project?

Good afternoon,
I am trying to install react and react-redux onto my project, but I keep getting errors that I don't understand.
$ npx create-react-app learn-redux
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Phelps\AppData\Roaming\npm-cache\_npx\13464" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Taylor Phelps\AppData\Roaming\npm-cache\_logs\2020-02-08T20_44_17_568Z-debug.log
Install for [ 'create-react-app#latest' ] failed with code 1
Could not install from "Phelps\AppData\Roaming\npm-cache\_npx\13464" as it does not contain a package.json file.
I am reading the error, but the problem is...that folder does not exist on my computer and I've checked in the terminal for npm and npx and both are installed on my computer. Does anyone have any ideas on why this may be happening and how to fix it?
Thank you.
According to this Github issue npx has trouble running on Windows if the user has a space in their name and from the error message I'd guess that is the case here. One of the suggested fixes is to set your npm-cache path to a folder without a space in it:
npm config set cache C:\tmp\nodejs\npm-cache --global
Then try running your command again.
Install the project in another directory except C partition :
npx create-react-app learnredux
Then :
npm i react-redux --save
This should work.
The problem is the npm cache by the path of the error. Try running:
npm cache verify
Verify the contents of the cache folder, garbage collecting any
unneeded data, and verifying the integrity of the cache index and all
cached data.
(from https://docs.npmjs.com/cli-commands/cache.html)

How to fix this json error while creating a new angular 8 project

i am facing this error, on visual studio code, immediately after having created a new angular 8 project:
PS C:\Users\HP\Desktop\stproject\my-app> npm install
npm ERR! Unexpected end of JSON input while parsing near '...eprecated"},"1.0.4":{'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs\2019-09-27T08_30_00_012Z-debug.log
The output is the above stated error, but this is wrong. The project should rather have been ready to be served using ng serve command.
kindly help....

#webpack-cli/init npm install failure [webpack-cli]

I tried installing webpack && webpack-cli and the installation was successful, but i when i tried installing #webpack-cli/init i got this error message:
npm ERR! Unexpected end of JSON input while parsing near '...f7d7c27ab73cfaae06c46'
I have searched if this error exits but could not find anything. Please what am i doing wrong?
Just clear npm cache
npm cache clean --force
that solved my problem
Works for me. Try resetting cache or something.