vuejs-templates / webpack

A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
MIT License
9.7k stars 4.38k forks source link

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

Closed hexyxj closed 6 years ago

hexyxj commented 7 years ago

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 signal-exit@3.0.2 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

LinusBorg commented 7 years ago

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

hexyxj commented 7 years ago

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! 👍

LinusBorg commented 6 years ago

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

PeterSamK commented 6 years ago

I reinstalled still it pops ups the same error message

LinusBorg commented 6 years ago

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.

PeterSamK commented 6 years ago

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 .

cqgsm commented 6 years ago

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

gentcdq commented 6 years ago

@cqgsm ni jie jue le ma?

tudou123xu commented 6 years ago

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

PeterSamK commented 6 years ago

@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

theoomoregbee commented 6 years ago

this solved it https://github.com/npm/npm/issues/19072#issuecomment-345555468

kaixinfu commented 6 years ago

I also have the same problem

kaixinfu commented 6 years ago

@tudou123xu npm cache clean --force

kwok7 commented 6 years ago

npm cache clean --force

that solved

ZhyCong commented 6 years ago

things done

PeterSamK commented 6 years ago

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 .

amith-cv commented 6 years ago

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 '<!DOCTYPE HTML PUBLI...'

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.

Frank14b commented 6 years ago

thks @kwok7 solve

18811376770 commented 6 years ago

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?

cauyyl commented 6 years ago

perfect!

thereisnowinter commented 6 years ago

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

Nditah commented 6 years ago

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

Shrimant12 commented 6 years ago

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

yug95 commented 6 years ago

npm cache clean --force this worked for me

anurag-git commented 6 years ago

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

ghost commented 6 years ago
  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
bolin-L commented 6 years ago

@KevinYY Thanks , the last point worked for me!

Mikearaya commented 6 years ago

thank you

Skinyi commented 6 years ago

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 '<!DOCTYPE html PUBLI...'

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.

magigedaniel commented 6 years ago

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

eladonline commented 6 years ago

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

AdelekeIO commented 6 years ago

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

DaltonHarvey commented 6 years ago

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

TonyBaiSAP commented 6 years ago

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

gokul-ch-pandey commented 6 years ago

The following step worked for me.

  1. Clear npm-cache from /users/{username}/AppData/Roaming/npm-cache
  2. Uninstall node
  3. Reinstall node.
hkk2016 commented 6 years ago

npm cache clean --force

This worked for me

kagaramag commented 6 years ago

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

victoralonsopacha commented 6 years ago

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

poralcode commented 6 years ago

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.

wangyangsea commented 6 years ago

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

anguskwan commented 6 years ago

dont use taobao repo, install goes well.

atachev commented 6 years ago

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

camille-zh commented 6 years ago

npm cache clean --force

This worked for me. @kwok7 Thanks so much!

RotondwaMudau commented 6 years ago

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

Higher-Stark commented 6 years ago

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.

EmmyMay commented 6 years ago

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

maheshankush02 commented 6 years ago

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.

jhchen6 commented 6 years ago

npm cache clean --force worked perfectly

IamSadiq commented 6 years ago

this also solved mine

npm cache clean --force

dwqs commented 6 years ago

npm cache clean --force

it's worked for me