Webpack: npm ERR! Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz"

Created on 17 Oct 2017  ·  192Comments  ·  Source: vuejs-templates/webpack

npm ERR! Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz" },'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\web-01\AppData\Roaming\npm-cache_logs\2017-10-17T08_41_53 _608Z-debug.log

error log

3693 silly resolveWithNewModule [email protected] checking installable status
3694 http fetch GET 304 https://registry.npm.taobao.org/array-find-index 70ms (from cache)
3695 silly fetchPackageMetaData error for array-find-index@^1.0.1 Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz"},'
3696 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz"},'
3696 verbose stack at Object.parse (native)
3696 verbose stack at parseJson (C:\Users\web-01\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-better-errors\index.js:7:17)
3696 verbose stack at consumeBody.call.then.buffer (C:\Users\web-01\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
3696 verbose stack at process._tickCallback (internal/process/next_tick.js:109:7)
3697 verbose cwd E:\project\my-app
3698 verbose Windows_NT 6.1.7601
3699 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\web-01\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "i"
3700 verbose node v6.11.4
3701 verbose npm v5.5.1
3702 error Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz"},'
3703 verbose exit [ 1, true ]

node 6.11.0
npm 5.5.1

Most helpful comment

npm cache clean --force

that solved

All 192 comments

Seems like there was just a download error. Did you try again?

I have reinstalled nodejs and vue-cli, and I tried to init a new project. while excuting npm install, above error showed again.
May be my environment matter...
thanks for you reply! 👍

I will close this since it seems to be a problem with your npm connection/mirror, not this template.

I reinstalled still it pops ups the same error message

I can't help you with that, because I can't reproduce the issue.

And the issue seems to be with the npm mirror (taobao) you are using - it's returning incomplete files.

If that's true, they have to fix their files, we can't do anything about this.

I solved the issues, It was due to a cache clear error (but *they auto
repair) had some data corruption which didn't let the JSON files to parse.
Thank you for the response Thorsten : )

Cheers,
Peter Sam K

On 12 November 2017 at 20:21, Thorsten Lünborg notifications@github.com
wrote:

I can't help you with that, because I can't reproduce the issue.

And the issue seems to be with the npm mirror (taobao) you are using -
it's returning incomplete files.

If that's true, they have to fix their files, we can't do anything about
this.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-343736884,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARH0420FSAdaU-6g-9ieQw5nZiQtjNP6ks5s1vDJgaJpZM4P7yXJ
.

@PeterSamK 你怎么解决的啊,我遇到了同样的问题

@cqgsm ni jie jue le ma?

I also encountered the same problem, how do you solve?
我也遇到了同样的问题,请问你怎么解决的?

@cqgsm Just completely uninstall the Node.js from Programs and Features and Re-install it,Make sure that you completely deleted all the node-modules and npm caches in the Npm folder and not present anywhere else

I also have the same problem

@tudou123xu npm cache clean --force

npm cache clean --force

that solved

things done

Yeah

On Sun, Apr 8, 2018, 8:28 AM 旺仔牛奶 notifications@github.com wrote:

things done


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-379515533,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARH040JnsmqyoUIXPGTmf9x1fnMAp9gxks5tmXy6gaJpZM4P7yXJ
.

Well I faced a similar issue while doing npm install --registry <_internal-npm-registry_> and it returned with the error like

npm ERR! Unexpected token < in JSON at position 0 while parsing near '

The problem was with the _internal-npm-registry_. I had to go to the internal jFrog repository to find out the setup up command to use the correct url.

Also there was no need for clearing the npm cache as suggested earlier.

thks @kwok7 solve

why there is still
npm ERR! Unexpected end of JSON input while parsing near '...hasShrinkwrap":false,'
after i run npm cache clean --force
and it just stucks here even without showing
ERR! A complete log of this run can be found in:
npm ERR! /Users/apple/.npm/_logs/2018-05-10T02_39_59_805Z-debug.log
and quitting?
Can someone help me?

perfect!

@18811376770 i had the same issue and when i reinstalled the NPM every error i faced has been solved.

@18811376770 Did yout tried npm cache clean --force? I tried it, but same error occurs.

Try clearing the npm cache at C:\Users\PC\AppData\Roaming\npm-cache\

npm cache clean --force
this worked for me :+1:

npm cache clean --force
this worked for me

"npm cache clean --force" didn't work for me but removing package-lock.json worked.

  1. npm cache clean --force
    try
    if false
  2. delete package.lock.json
    try again
    if false
  3. npm set registry https://registry.npmjs.org/ don't use taobao mirror
    try again

@KevinYY Thanks , the last point worked for me!

thank you

I have the same issue like this when i tried to install ”forever“:

npm ERR! Unexpected token < in JSON at position 0 while parsing near '

The version of my node.js is v8.11.2, npm version is 5.6.0, and my host operation system is CentOS 7
and i have tried all the solutions mentioned above but it`s still not worked.

Am experiencing same issue with react native app after upgrading expo:
the log does not have any helpful information

had the same problem and solved it like this:
open a directory and in the url enter this: C:\Users/\%username%\AppData\Roaming
search for npm-cache and rename it to npm-cache.old

What is the solution to this error?
npm install -g create-react-app reactproject
npm ERR! code E404
npm ERR! 404 Not Found: reactproject@latest

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2018-07-02T13_07_24_033Z-debug.log

Had the same problem:
npm ERR! Unexpected end of JSON input while parsing near '...compat.2.tgz","fileCo'

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\DALTON\AppData\Roaming\npm-cache\_logs\2018-07-20T12_47_18_001Z-debug.log

And the solution was:
npm cache clean --force

run npm cache clean --force working fine to me.

The following step worked for me.

  1. Clear npm-cache from /users/{username}/AppData/Roaming/npm-cache
  2. Uninstall node
  3. Reinstall node.

npm cache clean --force

This worked for me

I think it was a network issue while downloading the package
try
npm cache clean --force

i had the same error, the best option is uninstall all, node, npm and angular cli, repeat the installation and clean the cache of npm with:
npm cache clean --force
if is necessary for twice you try clean the cache

Had the same error, I had slow connection and this problem occurred, can't install it. I was thinking this some kind of problem with cache, Luckily I found the command for it so fast npm cache clean --force. then retry to install it with the following command npm install electron --save-dev and done.

我之前将npm默认使用淘宝源下载了,试了一下上面大佬的猜测,将npm重新指向了默认源,就好了

dont use taobao repo, install goes well.

thanks, @kwok7 ! It works for me also. :) 👍

npm cache clean --force

This worked for me. @kwok7 Thanks so much!

npm cache clean --force
This should do the trick
Might take time to run depending on the number of packages you have on cache

npm cache clean --force really works for me.
I rerun npm install with Taobao registry, and the error goes away. I assume registry is not concerned with the error.
@kwok7 Thanks a lot.

cleaning the cache with force solved the issue for "unexpected JSON parse error" when i tried installing vue cli 3

Remove the node_module folder from the project repository.
run the npm install -g @vue/cli.
And then run the command npm install.
Its works for me.

npm cache clean --force worked perfectly

this also solved mine

npm cache clean --force

npm cache clean --force

it's worked for me

try
npm cache clean --force
and then
npm install -g @angular/cli

It works for me.

Had the same problem:
npm ERR! Unexpected end of JSON input while parsing near '...compat.2.tgz","fileCo'

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\DALTON\AppData\Roaming\npm-cache\_logs\2018-07-20T12_47_18_001Z-debug.log

And the solution was:
npm cache clean --force

Thanks

Delete the node_modules and the package-lock.json and then execute the command.
In my case:
npm install nodemailer or npm install

This works for me.

npm cache clean --force

please i had the ame problem and did npm cache clean --force but this is what it is showing me now
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ETIMEDOUT: request to https://registry.npmjs.org/connect failed, reason: connect ETIMEDOUT 104.16.22.35:443
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/websocket-extensions failed, reason: connect ETIMEDOUT 104.16.21.35:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hp\AppData\Roaming\npm-cache_logs\2018-09-20T19_36_30_757Z-debug.log

PLEASE FOR HELP TO SOLVE THAT

what does "npm WARN rollback" means please which error is that

My issue was as following:
Unexpected end of JSON input while parsing near '...f2f9b8fd5ca9e429747e3'

My project was not installing and terminated in middle showing the above error, then googled I tried the following two commands:
npm install npm@latest -g
npm install --cache /tmp/empty-cache
when I executed the above two commands one after one. And, then I created the project and then I found no issue coming in middle to terminate, my project was successfully installed or created.
Hope this will be helpful to a few persons atleast.

Thanks il would ne very helpful

Le ven. 21 sept. 2018 à 09:58, gitmoin notifications@github.com a écrit :

My issue was as following:
Unexpected end of JSON input while parsing near '...f2f9b8fd5ca9e429747e3'

My project was not installing and terminated in middle showing the above
error, then googled I tried the following two commands:
npm install npm@latest -g
npm install --cache /tmp/empty-cache
when I executed the above two commands one after one. And, then I created
the project and then I found no issue coming in middle to terminate, my
project was successfully installed or created.
Hope this will be helpful to a few persons atleast.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-423464389,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Ao-XILnhTFDG7fGUqIToQRjloMJsUsPxks5udKovgaJpZM4P7yXJ
.

npm cache clean --force
solve this problem

thanks it worked

Le jeu. 27 sept. 2018 à 12:51, pradeep notifications@github.com a écrit :

npm cache clean --force
solve this problem


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-425061231,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Ao-XILf8T4ykotLIJcA3jdQzrWEHCNrYks5ufLvBgaJpZM4P7yXJ
.

Had the same issue.. Cleaning the cache worked for me.
"npm cache clean"

Ok thanks

Le mer. 3 oct. 2018 à 07:22, Ovais Ali notifications@github.com a écrit :

Had the same issue.. Cleaning the cache worked for me.
"npm cache clean"


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-426524390,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Ao-XII4nl_PZxK4oF4zvEMcb0x_VP9b2ks5uhFeKgaJpZM4P7yXJ
.

Salut a tous debutant dans le dev web j'aimerais bien apprendre le angular js et je voudrais savoir quel interface ou IDE pourrais aller le mieux avec ce framework.

npm cache clean --force

Ok thanks

Le ven. 12 oct. 2018 à 04:36, panw3i notifications@github.com a écrit :

npm cache clean --force


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-429193838,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Ao-XIO22FXXoBF_PKpbyybH912GRU19Tks5ukA5LgaJpZM4P7yXJ
.

I solved the issues, It was due to a cache clear error (but they auto repair) had some data corruption which didn't let the JSON files to parse. Thank you for the response Thorsten : ) Cheers, Peter Sam K

On 12 November 2017 at 20:21, Thorsten Lünborg
@.**> wrote: I can't help you with that, because I can't reproduce the issue. And the issue seems to be with the npm mirror (taobao) you are using - it's returning incomplete files. If that's true, they have to fix their files, we can't do anything about this. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#990 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ARH0420FSAdaU-6g-9ieQw5nZiQtjNP6ks5s1vDJgaJpZM4P7yXJ .

This helped me as well!!!!

To resolve issue, below command worked for me
npm cache clean --force
npm update
npm install
ng build
ng serve

npm cache clean --force

it works for me

npm cache clean --force

It's solve for me.

@kwok7 Thanks a lot!

just a comment, that error sometimes is because you did changes in your packege.json and react cannot read it and when you reinstall npm the package.json works because in building again.

I am trying to install firebase in my angular project but gotten that same error

My issue was as following:
Unexpected end of JSON input while parsing near '...f2f9b8fd5ca9e429747e3'

My project was not installing and terminated in middle showing the above error, then googled I tried the following two commands:
npm install npm@latest -g
npm install --cache /tmp/empty-cache
when I executed the above two commands one after one. And, then I created the project and then I found no issue coming in middle to terminate, my project was successfully installed or created.
Hope this will be helpful to a few persons atleast.

This "npm install npm@latest -g" worked for me! I really Thankful :)

Thanks I was later able to solve it by using "npm cache clean -- force" and
after it was done I input the command again and it works. Thanks

On Nov 1, 2018 1:53 PM, "Muhammad Afzal Khan" notifications@github.com
wrote:

My issue was as following:
Unexpected end of JSON input while parsing near '...f2f9b8fd5ca9e429747e3'

My project was not installing and terminated in middle showing the above
error, then googled I tried the following two commands:
npm install npm@latest -g
npm install --cache /tmp/empty-cache
when I executed the above two commands one after one. And, then I created
the project and then I found no issue coming in middle to terminate, my
project was successfully installed or created.
Hope this will be helpful to a few persons atleast.

This "npm install npm@latest -g" worked for me! I really Thankful :)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-435031481,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ApOBC-bkC_T1EmhHOtW03wTgw8eUI-jgks5uqu64gaJpZM4P7yXJ
.

npm cache's claim:

All data that passes through the cache is fully verified for integrity on both insertion and extraction. Cache corruption will either trigger an error, or signal to pacote that the data must be refetched, which it will do automatically. For this reason, it should never be necessary to clear the cache for any reason other than reclaiming disk space, thus why clean now requires --force to run.

The npm cache is strictly a cache: it should not be relied upon as a persistent and reliable data store for package data. npm makes no guarantee that a previously-cached piece of data will be available later, and will automatically delete corrupted contents. The primary guarantee that the cache makes is that, if it does return data, that data will be exactly the data that was inserted.

But based on several issues (pretty common I guess), npm cache's "corruption-proof" seem to be just assumptions, not reality. :'(

thanks @theo4u it worked for me . :)

npm cache clean --force

it's worked for me

npm cache clean --force
This work for me..
Thank you

第一种解决方法就是和上面一样:npm cache clean --force;
或者使用cnpm.

第二种就是:npm -g i npm@v
上面v表示版本

(其实就是网不好,缓存导致的)

npm cache clean --force

that solved

That really solves the issue. Thanks @kwok7 :)

I had to downgrade node and npm to 8.11.0 and 5.6.0 respectively and multiple tries with npm cache clean --force, finally it seems to be working now

@tudou123xu npm cache clean --force. That solved it quite alright. Great help guys

I have to agree with @deepakjha14 :

I had to downgrade node and npm to 8.11.0 and 5.6.0 respectively and multiple tries with npm cache clean --force, finally it seems to be working now

For me even npm cache clean --force "works" intermittently. I needed to do several retries (probably catching different error each time) until everything went correctly. It's quite obvious to me that the way npm cache works is not foolproof, there are some conditions (network?) that can corrupt its state.

npm cache clean --force

You are right. But I can't understand about bug correctly.

cleaning cache actually worked 👍

npm cache clean --force

For window :- got to

C:\Users\username\AppData\Roaming\npm-cache

Delete all file and run

npm install && npm start

pls help me am having this error when i tried to create new file
npm ERR! code ENOGIT
npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t ssh://[email protected]/expo/vector-icons.git
npm ERR!
npm ERR! undefined
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache_logs\2019-01-22T05_17_35_372Z-debug.log
[10:17:35] Process exited with non-zero code: 1
[10:17:35] Set EXPO_DEBUG=true in your env to view the stack trace.

npm cache clean worked for me

Thank you, I was having the same problem.

Debes eliminar el siguiente archivo 'package.lock.json', luego deberas correr npm install y deberia funcionar correctamente.

"npm cache clean --force" didn't work for me but removing package-lock.json worked.

finally I solved it, ty!

I also made the same mistake. Finally, I solved the problem by deleting all the contents in the cache folder. I hope I can help you.

@tudou123xu npm cache clean --force

you saved my life <3

this solved it npm/npm#19072 (comment)

god bless you

npm cache clean --force

worked for me, thanks

npm cache clean --force
this worked for me. thanks a million

npm cache clean --force

this is my solved

@tudou123xu npm cache clean --force

so good

npm cache clean --force

Thank you for solving the problem. Thank you for your interest and
dedicated guidance via mail.
Thank you so muchhhhhhhhhhhhhhh

Vào Th 5, 14 thg 3, 2019 vào lúc 18:52 Jack Chen notifications@github.com
đã viết:

npm cache clean --force


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-472820415,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AuAvemLyHRQTMMYHqRffekLmT7FQpp-zks5vWjfrgaJpZM4P7yXJ
.

Yeah! Thanks.
npm cache clean --force and then do what you are doing it's working

Yep tks so muchhhh

Vào Thứ Sáu, 15 tháng 3, 2019, Vimal Desai notifications@github.com đã
viết:

Yeah! Thanks.
npm cache clean --force and then do what you are doing it's working


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-473216587,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AuAveptM2T_0EHXpDlcttwvQIwvqZaogks5vW2fsgaJpZM4P7yXJ
.

it is npm error, i solve it by running this command : npm cache clean --force

first, npm cache clean --force
if not work, then, delete yarn.lock, package.lock.json
finally, delete node modules folder, and reinstall by npm install or yarn

seems this issue only appear in China area?
clear cache works, npm cache clean --force or just delete npm-cache/
or add --verbose to install cmd like:
npm i -g @vue/cli --verbose (I don't know why, it just worked)

uninstall the node and reinstall it. It works.

I use Windows and removed all the files that were listed below and my problem was solved
C:\Users{{your-username}}\AppData\Roaming\npm-cache

Awesome,, npm cache clean --force worked for me.. Thank You

npm cache clean --force
worked for me

npm cache clean --force
worked for me (be grateful)

npm cache clean --force
worked for me

try _npm cache clean --force_ most of the time it worked.
if it didn't work, delete every node folder and uninstall node. download the latest version, reinstall it. it works!

npm cache clean --force

solved my problem..

I don't know why
but downgrading npm version form the last to 4.6.0 all work fine.
"in my case npm tell me to do the downgrade"

npm install -g [email protected]

For windows

C:\Users\Master\AppData\Roaming\
and delete npm-cache folder

Solved my problem

"npm cache clean --force" didn't work for me but removing package-lock.json worked.

Go To this folder in you computer C:\Users\PC\AppData\Roaming
and delete the folder with the name of "npm cache"

then run "npm install --save firebase"

"I hope you know what you are doing"

I mean, it's not me who broke the cache because the slow internet 🤷‍♂

npm cache clean --force AND C:\Users\PC\AppData\Roaming
and delete , and Working!

try installing it by putting the --verbose, I was having a problem installing the angular cli and this solved my problem.

npm cache clean --force
this worked for me 👍

worked for me as well

yeah npm cache clean --force its work for me. thanks dude :+1:

force clean npm cache work great for me thank you

Try clearing the npm cache at C:\Users\PC\AppData\Roaming\npm-cache\

Thank you. The problems solved.

npm cache clean --force worked for me

things done

Thanks !
i solved this

npm cache clean --force

that solved

solved this👌👌👌

Use the below command to clear cache and then try installing pubnub:
npm cache clear --force
npm install pubnub

Thanks...!. Awesome.. "npm cache clean --force"
that solved the problem

managed to solve my problem by removing the Nodejs file inside the Arquivos de Programas file, later I uninstalled the Node, after that I excluded the file created with the error and launched the following steps shown below:
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli

This way my problem was solved

I tried all the solutions proposed here and other pages on stackoverflow with exception of uninstalling and reinstalling the node. But the only one that worked for me was this following command:

npm set registry https://registry.npmjs.org/

and then, the install came back to work again!

  1. npm cache clean --force
    2.npm install -g @angular/cli
    3.ng new name_project

This solved for me

best solution
npm cache clean --force

npm cache clean --force
its work for me. thank you

*Hello *

*Welcome *

Regards
Jitendra Kumar
React-Native and Android Developer

On Sun, Oct 20, 2019 at 12:38 AM Salahudin31 notifications@github.com
wrote:

npm cache clean --force
its work for me. thank you


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990?email_source=notifications&email_token=ANDETVV556ZAZCCNX7MAJQLQPNLJTA5CNFSM4D7PEXE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBX2SJY#issuecomment-544188711,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANDETVTHUCBX3W654A5NUW3QPNLJTANCNFSM4D7PEXEQ
.

@tudou123xu npm cache clean --force

that worked for me.

helpfull

npm cache clean --force
this one work

npm cache clean --force works for me too.
thank you so much

Clean cache : npm cache clean --force
and then npm install worked

npm cache clean --force

that solved

Thanks bro

npm cache clean --force

solve problem

Thank you , that solved

npm cache clean --force

solve my problem:
Thanks

i cant install nodemon, mongoose but i was able to install mongodb, any other package doesnt work and i get the above error. I've tried all the above solutions but none has worked

delete node_modules , delete package.lock.json
then run " npm install "

you can use " nvm " for maintaining node versions
"https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/"

Well I faced a similar issue while doing npm install --registry <_internal-npm-registry_> and it returned with the error like

npm ERR! Unexpected token < in JSON at position 0 while parsing near '

The problem was with the _internal-npm-registry_. I had to go to the internal jFrog repository to find out the setup up command to use the correct url.

Also there was no need for clearing the npm cache as suggested earlier.

Same issue. Saved my time. thanks

You need to execute from console:

npm cache clean --force

and then run the installation.

  1. Remove node_modules folder
  2. Remove package-lock.json
  3. Remove yarn.lock
  4. Run npm cache clean --force
  5. run npm install

I tried everything, nothing worked. I finally decided to try the good old "restart your computer trick", and it worked... I assume that it must have made one of the other fixes work.

npm cache clean --force
this worked

Installing packages...npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Unexpected end of JSON input while parsing near '...omise":"^1.0.0"},"dis'

npm ERR! A complete log of this run can be found in:

Nothing is working for me what should i do?

I had the same error while building a MERN app on Windows 10, I had built the server side, but had the error while trying to create the client side using npm create-react-app
So for whoever faces the same issue as I am, what worked for me is this:
npx create-react-app . _instead of_ npm create-react-app

npm cache clean --force worked for me
Thank you.

Tente limpar o cache do npm em C: \ Users \ PC \ AppData \ Roaming \ npm-cache \

funcionou para mim. thanks ♥.

Over 100 comments - why this issue not solved yet? (Or add to the official docs and steps "run" npm cache clean --force).

image

npm cache clean --force

This worked. Thankyou!

thanks for all your comments this is working

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Roaming\npm-cache_logs\2020-04-06T14_25_09_278Z-debug.log
ERROR command failed: npm install --loglevel error

whether this error (npm cache clean --force) is corrected after the code

npm cache clean --force
this run Thank you very much

npm cache clean --force
That worked!!!
Many thanks!

npm cache clean --force
or if you still face the problem delete the node_modules folder and run the installation command again

It worked for me, thanks
npm cache clean --force

npm cache clean --force

that solved

Thanks alot, this worked.

npm cache clean --force

that solved

Big man! you are a life saver :)

me funcionó el siguiente comando npm cache clean --force
no me dejaba instalar el nodemon y ahora todo esta normal

npm cache clean --force

that solved

Thanks alot, this worked. :+1: :heart:

npm cache clean --force.....this worked..thanks

👍

On Sun, 19 Apr 2020, 15:12 wayncis, notifications@github.com wrote:

npm cache clean --force

that solved

Thanks alot, this worked.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs-templates/webpack/issues/990#issuecomment-616088384,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANTP2EP44UQZE2WIGOJZAATRNLBQTANCNFSM4D7PEXEQ
.

npm cache clean --force

that solved

Thank you

npm cache clean --force

that solved

This solved my issue!

@PeterSamK 你怎么解决的啊,我遇到了同样的问题
npm cache clean --force

npm cache clean --force

this will help!!! 👯‍♂️

Can somebody close this issue? As so many people gave the correct solution to clean the cache?

npm cache clean --force

worked for me!

npm cache clean --force 👍

I had the same problem but npm cache clean --force didn't work for me. What I did was CLEAN MY PC using my cleaner(CCleaner) and npm install work now. I did it because the problem appears after I uninstall my node.js because I want to install nvm-windows on my PC (https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows), but after I did it I think some files and folders was leave behind making a conflict after I install node using nvm thus npm install do not work. So I thought cleaning my pc would solve the problem and it did.
These are just my thoughts. Hope to help someone.

npm cache clean --force

that solved

Could you tell me how to solve? I don't know where to execute this commad. And my OS is windows10.

I had the same problem but npm cache clean --force didn't work for me. What I did was CLEAN MY PC using my cleaner(CCleaner) and npm install work now. I did it because the problem appears after I uninstall my node.js because I want to install nvm-windows on my PC (https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows), but after I did it I think some files and folders was leave behind making a conflict after I install node using nvm thus npm install do not work. So I thought cleaning my pc would solve the problem and it did.
These are just my thoughts. Hope to help someone.

what OS do you use? Linux or Windows. It's an extreme way to do.

npm cache clean --force
that solved

Could you tell me how to solve? I don't know where to execute this commad. And my OS is windows10.

Open a command prompt (cli) inside your project folder and type the above command... You can do it inside your project folder

Thank you very much, It's work for me! 

------------------ 原始邮件 ------------------
发件人: "jopsyvarghese"<[email protected]>;
发送时间: 2020年6月15日(星期一) 晚上11:41
收件人: "vuejs-templates/webpack"<[email protected]>;
抄送: "你还是不明白吗"<[email protected]>;"Comment"<[email protected]>;
主题: Re: [vuejs-templates/webpack] npm ERR! Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz" (#990)

npm cache clean --force
that solved

Could you tell me how to solve? I don't know where to execute this commad. And my OS is windows10.

Open a command prompt (cli) inside your project folder and type the above command... You can do it inside your project folder


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

I had the same problem but npm cache clean --force didn't work for me. What I did was CLEAN MY PC using my cleaner(CCleaner) and npm install work now. I did it because the problem appears after I uninstall my node.js because I want to install nvm-windows on my PC (https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows), but after I did it I think some files and folders was leave behind making a conflict after I install node using nvm thus npm install do not work. So I thought cleaning my pc would solve the problem and it did.
These are just my thoughts. Hope to help someone.

what OS do you use? Linux or Windows. It's an extreme way to do.

Windows

npm cache clean --force

that solved

this works for me. Thanks 👍 💯

The command npm cache clean --force worked for me.

npm cache clear --force .... works for me

npm cache clean --force
remove node modules
install again
it works for me

So for anyone still getting this problem even after doing npm cache clear --force and npm cache verify then it could be your Antivirus blocking your installation using the command prompt. I checked my antivirus firewall settings and found that it was blocking requests from svchosts. You must unblock this to solve your issue, the process may differ depending on the AV you're using. You can then perform npm cache clear --force to clear any potentially corrupted files in the cache and a restart might also be necessary in some cases.

thank you guy npm cache clean --force solved my problem.

npm cache clean --force It's working

npm cache clean --force有用,有时候删除掉package-lock.json文件有效

Was this page helpful?
0 / 5 - 0 ratings