Gatsby: Unable to install gatsby - Unexpected end of JSON input while parsing near

Created on 11 Jun 2020  路  2Comments  路  Source: gatsbyjs/gatsby

I am trying to install gatsby-cli
npm install -g gatsby-cli

Expected result

To install gatsby-cli globally

Error

npm ERR! Unexpected end of JSON input while parsing near '...vmrIWDLQR9t4T+9x/x3sz'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\praveenAppData\Roaming\npm-cache_logs\2020-06-11T04_43_51_540Z-debug.log

Environment

Node : v12.17.0
NPM : 6.14.4

Log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'i',
1 verbose cli '-g',
1 verbose cli 'gatsby-cli'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 3047db9aa71e7a16
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/gatsby-cli 211ms (from cache)
8 silly fetchPackageMetaData error for gatsby-cli@latest Unexpected end of JSON input while parsing near '...vmrIWDLQR9t4T+9x/x3sz'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 257ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...vmrIWDLQR9t4T+9x/x3sz'
11 verbose stack at JSON.parse ()
11 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
11 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
11 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose cwd D:\kiran\portfolio\ResumeOnTheWeb-Gatsby
13 verbose Windows_NT 10.0.17763
14 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i" "-g" "gatsby-cli"
15 verbose node v12.17.0
16 verbose npm v6.14.4
17 error Unexpected end of JSON input while parsing near '...vmrIWDLQR9t4T+9x/x3sz'
18 verbose exit [ 1, true ]

bug

Most helpful comment

You might try running npm cache clean --force. See this thread on stackoverflow.

All 2 comments

You might try running npm cache clean --force. See this thread on stackoverflow.

Thank you for opening this!

As David said this is most likely an issue on your end with your local development environment. Please follow the instructions linked on StackOverflow and you should be good to go again!

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

Was this page helpful?
0 / 5 - 0 ratings