Node-postgres: Unexpected end of JSON input while parsing near '...aJ3U6wVqG9xBIRb3kWOO4'

Created on 30 Apr 2020  ยท  1Comment  ยท  Source: brianc/node-postgres

owner@G700:~/cp/test2$ node -v
v14.1.0

owner@G700:~/cp/test2$ npm i --save pg
npm ERR! Unexpected end of JSON input while parsing near '...aJ3U6wVqG9xBIRb3kWOO4'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/owner/.npm/_logs/2020-04-30T07_15_44_325Z-debug.log

owner@G700:~/cp/test2$ npm --version
6.14.4

And here is the debug log file output:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/owner/.nvm/versions/node/v14.1.0/bin/node',
1 verbose cli   '/home/owner/.nvm/versions/node/v14.1.0/bin/npm',
1 verbose cli   'i',
1 verbose cli   '--save',
1 verbose cli   'pg'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session a0d26d12fd27a34c
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/pg 405ms (from cache)
8 silly pacote tag manifest for pg@latest fetched in 446ms
9 timing stage:loadCurrentTree Completed in 497ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 53ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule [email protected] checking installable status
17 http fetch GET 304 https://registry.npmjs.org/packet-reader 359ms (from cache)
18 silly pacote version manifest for [email protected] fetched in 396ms
19 silly resolveWithNewModule [email protected] checking installable status
20 http fetch GET 304 https://registry.npmjs.org/semver 405ms (from cache)
21 silly fetchPackageMetaData error for [email protected] Unexpected end of JSON input while parsing near '...aJ3U6wVqG9xBIRb3kWOO4'
22 http fetch GET 304 https://registry.npmjs.org/pg-connection-string 441ms (from cache)
23 silly pacote version manifest for [email protected] fetched in 471ms
24 silly resolveWithNewModule [email protected] checking installable status
25 http fetch GET 304 https://registry.npmjs.org/buffer-writer 479ms (from cache)
26 silly pacote version manifest for [email protected] fetched in 498ms
27 silly resolveWithNewModule [email protected] checking installable status
28 http fetch GET 304 https://registry.npmjs.org/pgpass 511ms (from cache)
29 http fetch GET 304 https://registry.npmjs.org/pg-pool 517ms (from cache)
30 silly fetchPackageMetaData error for pg-pool@^3.1.1 Unexpected end of JSON input while parsing near '...Tm3eecaNkIefbHxFHjfb/'
31 http fetch GET 304 https://registry.npmjs.org/pg-types 520ms (from cache)
32 silly pacote range manifest for [email protected] fetched in 524ms
33 silly resolveWithNewModule [email protected] checking installable status
34 silly pacote range manifest for pg-types@^2.1.0 fetched in 538ms
35 silly resolveWithNewModule [email protected] checking installable status
36 http fetch GET 304 https://registry.npmjs.org/pg-protocol 546ms (from cache)
37 silly pacote range manifest for pg-protocol@^1.2.2 fetched in 577ms
38 silly resolveWithNewModule [email protected] checking installable status
39 timing stage:rollbackFailedOptional Completed in 1ms
40 timing stage:runTopLevelLifecycles Completed in 1158ms
41 silly saveTree [email protected]
41 silly saveTree โ””โ”€โ”ฌ [email protected]
41 silly saveTree   โ”œโ”€โ”€ [email protected]
41 silly saveTree   โ”œโ”€โ”€ [email protected]
41 silly saveTree   โ”œโ”€โ”€ [email protected]
41 silly saveTree   โ”œโ”€โ”€ [email protected]
41 silly saveTree   โ”œโ”€โ”€ [email protected]
41 silly saveTree   โ””โ”€โ”€ [email protected]
42 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...aJ3U6wVqG9xBIRb3kWOO4'
42 verbose stack     at JSON.parse (<anonymous>)
42 verbose stack     at parseJson (/home/owner/.nvm/versions/node/v14.1.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
42 verbose stack     at /home/owner/.nvm/versions/node/v14.1.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
42 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
43 verbose cwd /home/owner/cp/test2
44 verbose Linux 4.15.0-96-generic
45 verbose argv "/home/owner/.nvm/versions/node/v14.1.0/bin/node" "/home/owner/.nvm/versions/node/v14.1.0/bin/npm" "i" "--save" "pg"
46 verbose node v14.1.0
47 verbose npm  v6.14.4
48 error Unexpected end of JSON input while parsing near '...aJ3U6wVqG9xBIRb3kWOO4'
49 verbose exit [ 1, true ]

Other

  1. I am able to install all other packages
  2. This is a new project, specifically to test what the issue may be
  3. i have tried deleting package-lock.json and npm i but this did not help either
  4. I have tried installing pg in other projects. I encounter the same error.

Most helpful comment

If you tried to google for it, you would find right away that's your local NPM cache issue.

Just run this first:

npm cache clean --force

>All comments

If you tried to google for it, you would find right away that's your local NPM cache issue.

Just run this first:

npm cache clean --force
Was this page helpful?
0 / 5 - 0 ratings

Related issues

LukeSchlangen picture LukeSchlangen  ยท  4Comments

gpanainte picture gpanainte  ยท  3Comments

tonylukasavage picture tonylukasavage  ยท  4Comments

dipakdas99 picture dipakdas99  ยท  3Comments

joaquimknox picture joaquimknox  ยท  3Comments