immerjs / immer

Create the next immutable state by mutating the current one
https://immerjs.github.io/immer/
MIT License
27.73k stars 851 forks source link

Unable to install: Unexpected end of JSON input while parsing #546

Closed zeke closed 4 years ago

zeke commented 4 years ago

🐛 Bug Report

Hello, @mweststrate and maintainers 👋

I'm unable to install this package, but am not having trouble installing other packages.

Repro

$ npm i immer
npm ERR! Unexpected end of JSON input while parsing near '...bbUxpr2zZ5vL4G5HpDno5'
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/z/.npm/_logs/2020-03-01T06_00_42_344Z-debug.log

$ cat /Users/z/.npm/_logs/2020-03-01T06_00_42_344Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/z/.nodenv/versions/12.8.0/bin/node',
1 verbose cli   '/Users/z/.nodenv/versions/12.8.0/bin/npm',
1 verbose cli   'i',
1 verbose cli   'immer'
1 verbose cli ]
2 info using npm@6.10.2
3 info using node@v12.8.0
4 verbose npm-session 3a2444e728e7034c
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/immer 109ms (from cache)
8 silly fetchPackageMetaData error for immer@latest Unexpected end of JSON input while parsing near '...bbUxpr2zZ5vL4G5HpDno5'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 131ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...bbUxpr2zZ5vL4G5HpDno5'
11 verbose stack     at JSON.parse (<anonymous>)
11 verbose stack     at parseJson (/Users/z/.nodenv/versions/12.8.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
11 verbose stack     at /Users/z/.nodenv/versions/12.8.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
11 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:85:5)
12 verbose cwd /Users/z/Desktop
13 verbose Darwin 19.3.0
14 verbose argv "/Users/z/.nodenv/versions/12.8.0/bin/node" "/Users/z/.nodenv/versions/12.8.0/bin/npm" "i" "immer"
15 verbose node v12.8.0
16 verbose npm  v6.10.2
17 error Unexpected end of JSON input while parsing near '...bbUxpr2zZ5vL4G5HpDno5'
18 verbose exit [ 1, true ]

To Reproduce

$ npm install immer

Environment

$ node --version
v12.8.0

$ uname -a
Darwin zekes-mbp.lan 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
zeke commented 4 years ago

False alarm. It was my environment. npm cache clean --force did the trick. Closing.

mweststrate commented 4 years ago

Yeah, sorry, didn't look into your issue earlier, as it had no repro and npm wouldn't even allow publishing a package with broken package.json, so assumed it was on your end until proven otherwise :)

On Tue, Mar 3, 2020 at 4:36 PM Zeke Sikelianos notifications@github.com wrote:

Closed #546 https://github.com/immerjs/immer/issues/546.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/immerjs/immer/issues/546?email_source=notifications&email_token=AAN4NBAIUERTMOEC5UIBN6DRFUWXJA5CNFSM4K7B2UDKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOXBNIMEQ#event-3092940306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBBUZQXGAMDEU4NE46DRFUWXJANCNFSM4K7B2UDA .

augum commented 4 years ago

npm cache clean --force et après tu fais npm install -g npm à la fin de l'installation tu executes ta commande npm install immer

ajablanco commented 3 years ago

I had the same issue.. npm cach clean --force wasn't working for me. So i deleted node modules folder ran npm i once again.. and boom, it worked!

For anyone else having the same issues. :)