0

Till yesterday, there was no problem with my mac. But when today when i am trying to create or run an angular application, it fails to run. Actually the problem is with the node. Below is the response when i give the command in terminal. Please help me in resolving this issue.

    Naseefs-MacBook-Pro:cleardeskerp naseefali$ npm install
    npm WARN deprecated istanbul@0.4.5: This module is no longer 
      maintained, try this instead:
     npm WARN deprecated   npm i nyc
     npm WARN deprecated Visit https://istanbul.js.org/integrations for 
    other alternatives.
     npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance 
       only, flatted is its successor.
     npm ERR! Unexpected end of JSON input while parsing near ' 
     ..."@types/gulp-concat":'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/naseefali/.npm/_logs/2019-04-16T14_03_05_064Z-debug.log

Below is the last part of the debug log..

2164 silly resolveWithNewModule @angular-devkit/build-angular@0.13.8 checking installable status
2165 silly pacote range manifest for karma@~4.0.0 fetched in 8ms
2166 silly resolveWithNewModule karma@4.0.1 checking installable status
2167 silly pacote range manifest for karma-chrome-launcher@~2.2.0 fetched in 9ms
2168 silly resolveWithNewModule karma-chrome-launcher@2.2.0 checking installable status
2169 silly pacote range manifest for karma-coverage-istanbul-reporter@~2.0.1 fetched in 10ms
2170 silly resolveWithNewModule karma-coverage-istanbul-reporter@2.0.5 checking installable status
2171 silly pacote range manifest for karma-jasmine@~1.1.2 fetched in 10ms
2172 silly resolveWithNewModule karma-jasmine@1.1.2 checking installable status
2173 silly pacote range manifest for karma-jasmine-html-reporter@^0.2.2 fetched in 11ms
2174 silly resolveWithNewModule karma-jasmine-html-reporter@0.2.2 checking installable status
2175 silly pacote range manifest for protractor@~5.4.0 fetched in 12ms
2176 silly resolveWithNewModule protractor@5.4.2 checking installable status
2177 silly pacote range manifest for ts-node@~7.0.0 fetched in 9ms
2178 silly resolveWithNewModule ts-node@7.0.1 checking installable status
2179 silly pacote range manifest for tslint@~5.11.0 fetched in 10ms
2180 silly resolveWithNewModule tslint@5.11.0 checking installable status
2181 http fetch GET 200 https://registry.npmjs.org/typescript 12ms (from cache)
2182 silly fetchPackageMetaData error for typescript@~3.2.2 Unexpected end of JSON input while parsing near '..."@types/gulp-concat":'
2183 timing stage:rollbackFailedOptional Completed in 0ms
2184 timing stage:runTopLevelLifecycles Completed in 51557ms
2185 silly saveTree frontend@0.0.0
2185 silly saveTree ├─┬ @angular-devkit/build-angular@0.13.8
2185 silly saveTree │ └─┬ rxjs@6.3.3
2185 silly saveTree │   └── tslib@1.9.3
2185 silly saveTree ├── @angular/animations@7.2.13
2185 silly saveTree ├── @angular/cli@7.3.8
2185 silly saveTree ├── @angular/common@7.2.13
2185 silly saveTree ├── @angular/compiler-cli@7.2.13
2185 silly saveTree ├── @angular/compiler@7.2.13
2185 silly saveTree ├── @angular/core@7.2.13
2185 silly saveTree ├── @angular/forms@7.2.13
2185 silly saveTree ├── @angular/language-service@7.2.13
2185 silly saveTree ├── @angular/platform-browser-dynamic@7.2.13
2185 silly saveTree ├── @angular/platform-browser@7.2.13
2185 silly saveTree ├── @angular/router@7.2.13
2185 silly saveTree ├── @types/jasmine@2.8.16
2185 silly saveTree ├── @types/jasminewd2@2.0.6
2185 silly saveTree ├── @types/node@8.9.5
2185 silly saveTree ├── codelyzer@4.5.0
2185 silly saveTree ├── core-js@2.6.5
2185 silly saveTree ├── jasmine-core@2.99.1
2185 silly saveTree ├── jasmine-spec-reporter@4.2.1
2185 silly saveTree ├── karma-chrome-launcher@2.2.0
2185 silly saveTree ├── karma-coverage-istanbul-reporter@2.0.5
2185 silly saveTree ├─┬ karma-jasmine-html-reporter@0.2.2
2185 silly saveTree │ └── karma-jasmine@1.1.2
2185 silly saveTree ├── karma-jasmine@1.1.2
2185 silly saveTree ├── karma@4.0.1
2185 silly saveTree ├── protractor@5.4.2
2185 silly saveTree ├── rxjs@6.3.3
2185 silly saveTree ├── ts-node@7.0.1
2185 silly saveTree ├── tslib@1.9.3
2185 silly saveTree ├── tslint@5.11.0
2185 silly saveTree └── zone.js@0.8.29
2186 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."@types/gulp-concat":'
2186 verbose stack     at JSON.parse (<anonymous>)
2186 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
2186 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
2186 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
2187 verbose cwd /Users/naseefali/Desktop/ClearDesk/CD_ERP/frontend
2188 verbose Darwin 18.2.0
2189 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--quiet"
2190 verbose node v10.15.3
2191 verbose npm  v6.4.1
2192 error Unexpected end of JSON input while parsing near '..."@types/gulp-concat":'
2193 verbose exit [ 1, true ]
nircraft
  • 8,242
  • 5
  • 30
  • 46
Naseef Ali
  • 69
  • 11
  • Please provide the error details from the debug.log: **logs/2019-04-16T14_03_05_064Z-debug.log** Also please share your package.json details, node version and npm version used – nircraft Apr 16 '19 at 14:16
  • @nircraft it’s a very large file – Naseef Ali Apr 16 '19 at 14:31
  • just the last few lines where you see this error: ` npm ERR! Unexpected end of JSON input while parsing near ' ..."@types/gulp-concat":'` – nircraft Apr 16 '19 at 14:32
  • Yeah I have added it in the question.. please find it in the question... – Naseef Ali Apr 16 '19 at 14:34
  • Possible duplicate of [NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'](https://stackoverflow.com/questions/47675478/npm-install-errorunexpected-end-of-json-input-while-parsing-near-nt-webpack) – nircraft Apr 16 '19 at 14:39
  • can you post your package.json file? – Ashok Apr 16 '19 at 14:46

2 Answers2

0

It might be a NPM cache problem. Try this to repair NPM's cache.

npm cache verify

For more information, see https://docs.npmjs.com/cli/cache.html

Maffekill
  • 72
  • 6
0

This seems to be a problem with npm-cache. 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.

  1. Delete your package-lock.json file from the project directory.

  2. Delete your node_modules

  3. run npm cache clean --f

  4. run npm install
nircraft
  • 8,242
  • 5
  • 30
  • 46