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

Umesh17 commented 6 years ago

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

It works for me.

kimkyeseung 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

Thanks

duprez commented 6 years ago

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.

itsmaheshkariya commented 6 years ago

npm cache clean --force

tchouanga123 commented 6 years ago

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

tchouanga123 commented 6 years ago

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

gitmoin commented 6 years ago

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.

tchouanga123 commented 6 years ago

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 .

pradeepsr029 commented 6 years ago

npm cache clean --force solve this problem

tchouanga123 commented 6 years ago

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 .

RuthenicEye commented 6 years ago

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

tchouanga123 commented 6 years ago

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 .

Ninon01 commented 6 years ago

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.

panw3i commented 6 years ago

npm cache clean --force

tchouanga123 commented 6 years ago

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 .

auleki 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 @.***> 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!!!!

rajkiit116 commented 6 years ago

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

yewenjunfighting commented 6 years ago

npm cache clean --force

it works for me

alexgred commented 6 years ago

npm cache clean --force

It's solve for me.

zqq198976 commented 6 years ago

@kwok7 Thanks a lot!

DolceLemus commented 6 years ago

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.

Oredunni1 commented 5 years ago

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

MAfzalKhan1997 commented 5 years ago

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 :)

Oredunni1 commented 5 years ago

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 .

ceefour commented 5 years ago

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. :'(

ImCharmainejoy commented 5 years ago

thanks @theo4u it worked for me . :)

iampkmaurya commented 5 years ago

npm cache clean --force

it's worked for me

PriyankaPungaonkar commented 5 years ago

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

yelloxing commented 5 years ago

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

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

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

satishdash commented 5 years ago

npm cache clean --force

that solved

That really solves the issue. Thanks @kwok7 :)

deepakjha14 commented 5 years ago

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

lil-armstrong commented 5 years ago

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

ceefour commented 5 years ago

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.

alivesoftsnowman commented 5 years ago

npm cache clean --force

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

Mohammed-Usman commented 5 years ago

cleaning cache actually worked 👍

mahendramahi commented 5 years ago

npm cache clean --force

For window :- got to

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

Delete all file and run

npm install && npm start

Remig9 commented 5 years ago

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://git@github.com/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.

askshinde commented 5 years ago

npm cache clean worked for me

luizfonseca830 commented 5 years ago

Thank you, I was having the same problem.

eytoo commented 5 years ago

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

caldaravi commented 5 years ago

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

finally I solved it, ty!

booyoungchen commented 5 years ago

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.

asufshafee commented 5 years ago

@tudou123xu npm cache clean --force

you saved my life <3

nguyenphi0205 commented 5 years ago

this solved it npm/npm#19072 (comment)

god bless you

kjym commented 5 years ago

npm cache clean --force

worked for me, thanks

ifeanyi-ajimah commented 5 years ago

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

AdolphKevin commented 5 years ago

npm cache clean --force

this is my solved

nttd2211 commented 5 years ago

@tudou123xu npm cache clean --force

so good

chenchangyuan commented 5 years ago

npm cache clean --force

nttd2211 commented 5 years ago

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 .