Reputation: 223
I am trying to create a vue3 project but unfortunately getting an error. please help me how can I resolve that thanks.
developer@developer-ThinkCentre-M93p:~$ vue create my-app
Vue CLI v4.5.11
? Please pick a preset: Default (Vue 3 Preview) ([Vue 3] babel, eslint)
Vue CLI v4.5.11
✨ Creating project in /home/developer/my-app.
🗃 Initializing git repository... ⚙️ Installing CLI plugins.
This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '...G86w5sVNCz3K/igO52X4z'
npm ERR! A complete log of this run can be found in: npm ERR! /home/developer/.npm/_logs/2021-01-27T04_43_44_270Z-debug.log ERROR command failed: npm install --loglevel error
Upvotes: 0
Views: 1118
Reputation: 2691
npm cache clean --force
This is an npm related issue, it has to do with the cache being corrupted. Even though they have implemented self-healing in newer versions of npm, which usually doesn't guarantee any damage, it doesn't seem to be that effective. Clearing the cache forcibly solves this problem.
The error occurs when parsing one of the cache files in json format. The cache is located in ~ / .npm / _cacache (on linux) and% AppData% / npm-cache (windows). For my current npm version, and when I checked, there were three directories in there.
Here is a good link from the doc: https://docs.npmjs.com/cli/v6/commands/npm-cache
[Update] Also, if it happens that this doesn't solve the problem, you can check this answer here https://stackoverflow.com/a/50191315/7668448 it shows how you can modify the npm registry which might be helpful. Check it out and see.
Upvotes: 0
Reputation: 35684
likely a cache issue
Some things to try:
npm i npm@latest -g
sudo npm i npm@latest -g
npm cache clean --force
sudo npm cache clean --force
Upvotes: 1