This repository has been archived by the owner. It is now read-only.

Installing ERROR | Unexpected end of JSON input while parsing near ' : ' #19072

Closed
feroz39 opened this Issue Nov 6, 2017 · 35 comments

Comments

Projects
None yet
@feroz39
Copy link

feroz39 commented Nov 6, 2017

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

My command line produces this error each time when I want to install almost anything(angular/cli in this case)

npm install -g @angular/cli
npm ERR! Unexpected end of JSON input while parsing near '...ion":"1.9.0-dev.20160'

How can the CLI team reproduce the problem?

The Error log file contains:

0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\node.exe', 1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install', 1 verbose cli '-g', 1 verbose cli '@angular/cli' ] 2 info using npm@5.5.1 3 info using node@v8.9.0 4 verbose npm-session d9532dae65c3876f 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 http fetch GET 200 http://registry.npmjs.org/@angular%2fcli 1078ms 8 silly pacote tag manifest for @angular/cli@latest fetched in 1157ms 9 silly install loadIdealTree 10 silly install cloneCurrentTreeToIdealTree 11 silly install loadShrinkwrap 12 silly install loadAllDepsIntoIdealTree 13 silly resolveWithNewModule @angular/cli@1.5.0 checking installable status 14 http fetch GET 200 http://registry.npmjs.org/@angular-devkit%2fbuild-optimizer 453ms 15 silly pacote range manifest for @angular-devkit/build-optimizer@~0.0.31 fetched in 501ms 16 silly resolveWithNewModule @angular-devkit/build-optimizer@0.0.32 checking installable status 17 http fetch GET 200 http://registry.npmjs.org/copy-webpack-plugin 547ms 18 http fetch GET 200 http://registry.npmjs.org/circular-dependency-plugin 563ms 19 http fetch GET 200 http://registry.npmjs.org/common-tags 563ms 20 http fetch GET 200 http://registry.npmjs.org/chalk 578ms 21 silly pacote range manifest for copy-webpack-plugin@^4.1.1 fetched in 578ms 22 silly resolveWithNewModule copy-webpack-plugin@4.2.0 checking installable status 23 silly pacote range manifest for circular-dependency-plugin@^3.0.0 fetched in 578ms 24 silly resolveWithNewModule circular-dependency-plugin@3.0.0 checking installable status 25 silly pacote range manifest for common-tags@^1.3.1 fetched in 594ms 26 silly resolveWithNewModule common-tags@1.4.0 checking installable status 27 http fetch GET 200 http://registry.npmjs.org/autoprefixer 594ms 28 silly pacote range manifest for chalk@~2.2.0 fetched in 610ms 29 silly resolveWithNewModule chalk@2.2.2 checking installable status 30 http fetch GET 200 http://registry.npmjs.org/@ngtools%2fjson-schema 640ms 31 silly pacote range manifest for autoprefixer@^6.5.3 fetched in 641ms 32 silly resolveWithNewModule autoprefixer@6.7.7 checking installable status 33 silly pacote version manifest for @ngtools/json-schema@1.1.0 fetched in 672ms 34 silly resolveWithNewModule @ngtools/json-schema@1.1.0 checking installable status 35 http fetch GET 200 http://registry.npmjs.org/@schematics%2fangular 672ms 36 silly pacote range manifest for @schematics/angular@~0.1.0 fetched in 688ms 37 silly resolveWithNewModule @schematics/angular@0.1.1 checking installable status 38 http fetch GET 200 http://registry.npmjs.org/@angular-devkit%2fschematics 719ms 39 silly pacote range manifest for @angular-devkit/schematics@~0.0.34 fetched in 735ms 40 silly resolveWithNewModule @angular-devkit/schematics@0.0.35 checking installable status 41 http fetch GET 200 http://registry.npmjs.org/@ngtools%2fwebpack 766ms 42 silly pacote version manifest for @ngtools/webpack@1.8.0 fetched in 781ms 43 silly resolveWithNewModule @ngtools/webpack@1.8.0 checking installable status 44 http fetch GET 200 http://registry.npmjs.org/core-object 312ms 45 silly pacote range manifest for core-object@^3.1.0 fetched in 327ms 46 silly resolveWithNewModule core-object@3.1.5 checking installable status 47 http fetch GET 200 http://registry.npmjs.org/css-loader 297ms 48 http fetch GET 200 http://registry.npmjs.org/cssnano 313ms 49 http fetch GET 200 http://registry.npmjs.org/denodeify 329ms 50 http fetch GET 200 http://registry.npmjs.org/ember-cli-string-utils 313ms 51 silly pacote range manifest for css-loader@^0.28.1 fetched in 345ms 52 silly resolveWithNewModule css-loader@0.28.7 checking installable status 53 silly pacote range manifest for ember-cli-string-utils@^1.0.0 fetched in 328ms 54 silly resolveWithNewModule ember-cli-string-utils@1.1.0 checking installable status 55 silly pacote range manifest for cssnano@^3.10.0 fetched in 360ms 56 silly resolveWithNewModule cssnano@3.10.0 checking installable status 57 silly pacote range manifest for denodeify@^1.2.1 fetched in 359ms 58 silly resolveWithNewModule denodeify@1.2.1 checking installable status 59 http fetch GET 200 http://registry.npmjs.org/extract-text-webpack-plugin 328ms 60 http fetch GET 200 http://registry.npmjs.org/exports-loader 328ms 61 http fetch GET 200 http://registry.npmjs.org/file-loader 281ms 62 silly pacote version manifest for extract-text-webpack-plugin@3.0.0 fetched in 344ms 63 silly resolveWithNewModule extract-text-webpack-plugin@3.0.0 checking installable status 64 silly pacote range manifest for exports-loader@^0.6.3 fetched in 344ms 65 silly resolveWithNewModule exports-loader@0.6.4 checking installable status 66 http fetch GET 200 http://registry.npmjs.org/fs-extra 296ms 67 silly pacote range manifest for file-loader@^1.1.5 fetched in 312ms 68 silly resolveWithNewModule file-loader@1.1.5 checking installable status 69 silly pacote range manifest for fs-extra@^4.0.0 fetched in 312ms 70 silly resolveWithNewModule fs-extra@4.0.2 checking installable status 71 http fetch GET 200 http://registry.npmjs.org/glob 281ms 72 http fetch GET 200 http://registry.npmjs.org/html-webpack-plugin 282ms 73 silly pacote range manifest for glob@^7.0.3 fetched in 328ms 74 silly resolveWithNewModule glob@7.1.2 checking installable status 75 silly pacote range manifest for html-webpack-plugin@^2.29.0 fetched in 313ms 76 silly resolveWithNewModule html-webpack-plugin@2.30.1 checking installable status 77 http fetch GET 200 http://registry.npmjs.org/karma-source-map-support 281ms 78 http fetch GET 200 http://registry.npmjs.org/less-loader 297ms 79 http fetch GET 200 http://registry.npmjs.org/less 297ms 80 silly pacote range manifest for karma-source-map-support@^1.2.0 fetched in 312ms 81 silly resolveWithNewModule karma-source-map-support@1.2.0 checking installable status 82 http fetch GET 200 http://registry.npmjs.org/license-webpack-plugin 313ms 83 silly pacote range manifest for less@^2.7.2 fetched in 328ms 84 silly resolveWithNewModule less@2.7.3 checking installable status 85 silly pacote range manifest for less-loader@^4.0.5 fetched in 328ms 86 silly resolveWithNewModule less-loader@4.0.5 checking installable status 87 http fetch GET 200 http://registry.npmjs.org/memory-fs 297ms 88 http fetch GET 200 http://registry.npmjs.org/lodash 297ms 89 silly pacote range manifest for license-webpack-plugin@^1.0.0 fetched in 360ms 90 silly resolveWithNewModule license-webpack-plugin@1.1.1 checking installable status 91 http fetch GET 200 http://registry.npmjs.org/nopt 297ms 92 silly pacote range manifest for memory-fs@^0.4.1 fetched in 328ms 93 silly resolveWithNewModule memory-fs@0.4.1 checking installable status 94 silly pacote range manifest for lodash@^4.11.1 fetched in 343ms 95 silly resolveWithNewModule lodash@4.17.4 checking installable status 96 http fetch GET 200 http://registry.npmjs.org/node-modules-path 328ms 97 silly pacote range manifest for nopt@^4.0.1 fetched in 328ms 98 silly resolveWithNewModule nopt@4.0.1 checking installable status 99 silly pacote range manifest for node-modules-path@^1.0.0 fetched in 391ms 100 silly resolveWithNewModule node-modules-path@1.0.1 checking installable status 101 http fetch GET 200 http://registry.npmjs.org/portfinder 313ms 102 http fetch GET 200 http://registry.npmjs.org/opn 453ms 103 silly pacote range manifest for portfinder@~1.0.12 fetched in 469ms 104 silly resolveWithNewModule portfinder@1.0.13 checking installable status 105 silly pacote range manifest for opn@~5.1.0 fetched in 469ms 106 silly resolveWithNewModule opn@5.1.0 checking installable status 107 http fetch GET 200 http://registry.npmjs.org/silent-error 297ms 108 http fetch GET 200 http://registry.npmjs.org/source-map-loader 312ms 109 silly pacote range manifest for silent-error@^1.0.0 fetched in 328ms 110 silly resolveWithNewModule silent-error@1.1.0 checking installable status 111 silly pacote range manifest for source-map-loader@^0.2.0 fetched in 344ms 112 silly resolveWithNewModule source-map-loader@0.2.3 checking installable status 113 http fetch GET 200 http://registry.npmjs.org/source-map-support 188ms 114 http fetch GET 200 http://registry.npmjs.org/istanbul-instrumenter-loader 172ms 115 silly pacote range manifest for source-map-support@^0.4.1 fetched in 203ms 116 silly resolveWithNewModule source-map-support@0.4.18 checking installable status 117 silly pacote range manifest for istanbul-instrumenter-loader@^2.0.0 fetched in 203ms 118 silly resolveWithNewModule istanbul-instrumenter-loader@2.0.0 checking installable status 119 http fetch GET 200 http://registry.npmjs.org/style-loader 125ms 120 http fetch GET 200 http://registry.npmjs.org/stylus 125ms 121 silly pacote range manifest for style-loader@^0.13.1 fetched in 141ms 122 silly resolveWithNewModule style-loader@0.13.2 checking installable status 123 silly pacote range manifest for stylus@^0.54.5 fetched in 140ms 124 silly resolveWithNewModule stylus@0.54.5 checking installable status 125 http fetch GET 200 http://registry.npmjs.org/stylus-loader 94ms 126 silly pacote range manifest for stylus-loader@^3.0.1 fetched in 109ms 127 silly resolveWithNewModule stylus-loader@3.0.1 checking installable status 128 http fetch GET 200 http://registry.npmjs.org/uglifyjs-webpack-plugin 94ms 129 silly pacote version manifest for uglifyjs-webpack-plugin@1.0.0 fetched in 126ms 130 silly resolveWithNewModule uglifyjs-webpack-plugin@1.0.0 checking installable status 131 http fetch GET 200 http://registry.npmjs.org/url-loader 94ms 132 silly pacote range manifest for url-loader@^0.6.2 fetched in 110ms 133 silly resolveWithNewModule url-loader@0.6.2 checking installable status 134 http fetch GET 200 http://registry.npmjs.org/webpack 281ms 135 silly pacote range manifest for webpack@~3.8.1 fetched in 296ms 136 silly resolveWithNewModule webpack@3.8.1 checking installable status 137 http fetch GET 200 http://registry.npmjs.org/webpack-concat-plugin 250ms 138 silly pacote version manifest for webpack-concat-plugin@1.4.0 fetched in 265ms 139 silly resolveWithNewModule webpack-concat-plugin@1.4.0 checking installable status 140 http fetch GET 200 http://registry.npmjs.org/webpack-dev-middleware 266ms 141 http fetch GET 200 http://registry.npmjs.org/webpack-dev-server 235ms 142 silly pacote range manifest for webpack-dev-middleware@~1.12.0 fetched in 297ms 143 silly resolveWithNewModule webpack-dev-middleware@1.12.0 checking installable status 144 silly pacote range manifest for webpack-dev-server@~2.9.3 fetched in 250ms 145 silly resolveWithNewModule webpack-dev-server@2.9.4 checking installable status 146 http fetch GET 200 http://registry.npmjs.org/webpack-sources 109ms 147 silly pacote range manifest for webpack-sources@^1.0.0 fetched in 109ms 148 silly resolveWithNewModule webpack-sources@1.0.2 checking installable status 149 http fetch GET 200 http://registry.npmjs.org/webpack-merge 250ms 150 silly pacote range manifest for webpack-merge@^4.1.0 fetched in 282ms 151 silly resolveWithNewModule webpack-merge@4.1.1 checking installable status 152 http fetch GET 200 http://registry.npmjs.org/zone.js 94ms 153 silly pacote range manifest for zone.js@^0.8.14 fetched in 172ms 154 silly resolveWithNewModule zone.js@0.8.18 checking installable status 155 http fetch GET 200 http://registry.npmjs.org/node-sass 125ms 156 silly pacote range manifest for node-sass@^4.3.0 fetched in 125ms 157 silly resolveWithNewModule node-sass@4.6.0 checking installable status 158 http fetch GET 200 http://registry.npmjs.org/webpack-subresource-integrity 703ms 159 silly pacote range manifest for webpack-subresource-integrity@^1.0.1 fetched in 703ms 160 silly resolveWithNewModule webpack-subresource-integrity@1.0.1 checking installable status 161 http fetch GET 200 http://registry.npmjs.org/postcss-url 10579ms attempt #2 162 silly pacote range manifest for postcss-url@^5.1.2 fetched in 10595ms 163 silly resolveWithNewModule postcss-url@5.1.2 checking installable status 164 http fetch GET 200 http://registry.npmjs.org/postcss-loader 10595ms attempt #2 165 silly pacote range manifest for postcss-loader@^1.3.3 fetched in 10610ms 166 silly resolveWithNewModule postcss-loader@1.3.3 checking installable status 167 http fetch GET 200 http://registry.npmjs.org/resolve 10563ms attempt #2 168 http fetch GET 200 http://registry.npmjs.org/postcss-custom-properties 10642ms attempt #2 169 silly pacote range manifest for resolve@^1.1.7 fetched in 10579ms 170 silly resolveWithNewModule resolve@1.5.0 checking installable status 171 silly pacote range manifest for postcss-custom-properties@^6.1.0 fetched in 10658ms 172 silly resolveWithNewModule postcss-custom-properties@6.2.0 checking installable status 173 http fetch GET 200 http://registry.npmjs.org/raw-loader 10626ms attempt #2 174 http fetch GET 200 http://registry.npmjs.org/sass-loader 10595ms attempt #2 175 http fetch GET 200 http://registry.npmjs.org/rxjs 10627ms attempt #2 176 silly pacote range manifest for raw-loader@^0.5.1 fetched in 10657ms 177 silly resolveWithNewModule raw-loader@0.5.1 checking installable status 178 silly pacote range manifest for sass-loader@^6.0.3 fetched in 10626ms 179 silly resolveWithNewModule sass-loader@6.0.6 checking installable status 180 silly pacote range manifest for rxjs@^5.5.2 fetched in 10642ms 181 silly resolveWithNewModule rxjs@5.5.2 checking installable status 182 http fetch GET 200 http://registry.npmjs.org/semver 10595ms attempt #2 183 silly pacote range manifest for semver@^5.1.0 fetched in 10611ms 184 silly resolveWithNewModule semver@5.4.1 checking installable status 185 http fetch GET 200 http://registry.npmjs.org/loader-utils 296ms 186 silly pacote range manifest for loader-utils@^1.1.0 fetched in 312ms 187 silly resolveWithNewModule loader-utils@1.1.0 checking installable status 188 http fetch GET 200 http://registry.npmjs.org/source-map 328ms 189 silly pacote range manifest for source-map@^0.5.6 fetched in 343ms 190 silly resolveWithNewModule source-map@0.5.7 checking installable status 191 http fetch GET 200 http://registry.npmjs.org/typescript 390ms 192 silly fetchPackageMetaData error for typescript@^2.3.3 Unexpected end of JSON input while parsing near '...ion":"1.9.0-dev.20160' 193 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ion":"1.9.0-dev.20160' 193 verbose stack at JSON.parse (<anonymous>) 193 verbose stack at parseJson (C:\Program Files (x86)\nodejs\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) 193 verbose stack at consumeBody.call.then.buffer (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50) 193 verbose stack at <anonymous> 193 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7) 194 verbose cwd C:\Users\Feroz 195 verbose Windows_NT 10.0.10240 196 verbose argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli" 197 verbose node v8.9.0 198 verbose npm v5.5.1 199 error Unexpected end of JSON input while parsing near '...ion":"1.9.0-dev.20160' 200 verbose exit [ 1, true ]

**
I attempting to install angular in my machine but I never successfully installed in last one week and I never try to install anything else. Please let me know why the error comes.
**

supporting information:

  • npm -v prints: 5.5.1
  • node -v prints: v8.9.0
  • npm config get registry prints: http://registry.npmjs.org/
  • Windows, OS X/macOS, or Linux?: Windows
  • Network issues:
    • Geographic location where npm was run: Bangladesh
@rahul230691

This comment has been minimized.

Copy link

rahul230691 commented Nov 11, 2017

I am also facing the same issue when creating new project with @angular/cli. In my case, exception is below -
npm ERR! Unexpected end of JSON input while parsing near '..."5.1.2","tslint":"5.6'

Information about the software and machine -

npm -v prints 5.5.1
node -v prints 8.9.0
ng -v prints Angular CLI 1.5.0
Windows OS:Win32 X64

Any help ! Please

@rahul230691

This comment has been minimized.

Copy link

rahul230691 commented Nov 11, 2017

Downgraded to npm v5.3, still didn't work for me (earlier was npm v5.4). Had to downgrade to npm v4.6.1 and it worked fine.

@theo4u

This comment has been minimized.

Copy link

theo4u commented Nov 19, 2017

this solved it npm cache clean --force

@PeterSamK

This comment has been minimized.

Copy link

PeterSamK commented Nov 21, 2017

Yes,Clear the npm cache, If PLAN A doesn't work , Delete the complete npm cache and npm files from the folder and re-install it completely.
And *The Current Version has some connectivity issues

@impulsynick

This comment has been minimized.

Copy link

impulsynick commented Dec 14, 2017

npm cache clean --force
then
npm install -g @angular/cli
worked for me

@cloudotswm

This comment has been minimized.

Copy link

cloudotswm commented Jan 3, 2018

thank you for the cache clean method

1 similar comment
@skychx

This comment has been minimized.

Copy link

skychx commented Jan 10, 2018

thank you for the cache clean method

@parrainc

This comment has been minimized.

Copy link

parrainc commented Jan 14, 2018

Clean cache and then npm install worked for me as well :)

@AntoineElikem

This comment has been minimized.

Copy link

AntoineElikem commented Feb 1, 2018

Re-installed node and cleared cache but still DOES NOT WORK.

Am using windows 10

@zhunode

This comment has been minimized.

Copy link

zhunode commented Feb 5, 2018

here is the problem i meet : npm ERR! Unexpected end of JSON input while parsing near '...st":{"shasum":"bd3b45' .
i search the author advise to solve my problem. it worked.
the steps is:
npm cache clean --force
then
npm install -g @angular/cli
worked for me

@Daneshwaran

This comment has been minimized.

Copy link

Daneshwaran commented Feb 20, 2018

clean cache worked for me...

@KenanY KenanY added the support label Feb 20, 2018

@feroz39

This comment has been minimized.

Copy link
Author

feroz39 commented Feb 20, 2018

Thanks all, It is working now.

@feroz39 feroz39 closed this Feb 20, 2018

@marciordonez

This comment has been minimized.

Copy link

marciordonez commented Mar 2, 2018

Replace spaces with tabs (indentation) in your .json file worked for me!

@wuhenzhizao

This comment has been minimized.

Copy link

wuhenzhizao commented Mar 19, 2018

Command "brew install node" will install the newest version of node and npm, downgrade them to a stable version will solve it,

@AmirTugi

This comment has been minimized.

Copy link

AmirTugi commented Apr 12, 2018

I just had a bad package-lock.json due to a merge I've made.
Remove it and it'll work.

@Can2Nya

This comment has been minimized.

Copy link

Can2Nya commented May 23, 2018

thank you for the cache clean method

@atul1600

This comment has been minimized.

Copy link

atul1600 commented May 26, 2018

thanks cache clean methods works

@heyaf

This comment has been minimized.

Copy link

heyaf commented May 31, 2018

thanks

@zhangyh123

This comment has been minimized.

Copy link

zhangyh123 commented Jun 6, 2018

rm -rf node-modules

npm cache clean --force
try
npm install
if false
delete package.lock.json
try again

@KevinYY

This comment has been minimized.

Copy link

KevinYY commented Jun 8, 2018

if u in china ,try npm set registry https://registry.npmjs.org/ don't use taobao mirror

@MrZhongFF

This comment has been minimized.

Copy link

MrZhongFF commented Jun 9, 2018

Maybe it's the problem of registry config.
npm config set registry https://registry.npmjs.org/ , I set the registry config to the default and it works.
Before this , my registry is http://registry.npm.taobao.org/ and encounters such issue.

@rajan98

This comment has been minimized.

Copy link

rajan98 commented Jun 10, 2018

Thanks for the solution bro.

@ytan1

This comment has been minimized.

Copy link

ytan1 commented Jun 11, 2018

Thanks so much. Work for me

@supertech1

This comment has been minimized.

Copy link

supertech1 commented Jun 17, 2018

thanks....clean cache worked for me

@rantoinne

This comment has been minimized.

Copy link

rantoinne commented Jun 18, 2018

clearing cache worked for me on windows 10

@amaduela

This comment has been minimized.

Copy link

amaduela commented Jun 18, 2018

Thanks it worked for me too

@tyosssss

This comment has been minimized.

Copy link

tyosssss commented Jun 20, 2018

thanks.
npm cache clean --force

@Nuzairb

This comment has been minimized.

Copy link

Nuzairb commented Jun 23, 2018

npm cache clean --force
worked for me thanks

@zhangxistudy11

This comment has been minimized.

Copy link

zhangxistudy11 commented Jun 23, 2018

@zhunode Thank you.It worked fine.

@ganksolo

This comment has been minimized.

Copy link

ganksolo commented Jun 25, 2018

thanks, worked!!!

@rohitmishra209

This comment has been minimized.

Copy link

rohitmishra209 commented Jun 28, 2018

npm cache clean --force worked for me..Thanks

@vipins-optimus

This comment has been minimized.

Copy link

vipins-optimus commented Jun 30, 2018

this solved it npm cache clean --force

@Akinolubosi

This comment has been minimized.

Copy link

Akinolubosi commented Jul 4, 2018

npm cache clean --force worked perfectly...thanks

@david95thinkcode

This comment has been minimized.

Copy link

david95thinkcode commented Jul 7, 2018

It works :) thanks

@LarrySul

This comment has been minimized.

Copy link

LarrySul commented Jul 8, 2018

clean cache worked like charm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.