Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error Unexpected end of JSON input while parsing near '...","tarball":"https://'

I am getting

error Unexpected end of JSON input while parsing near '...","tarball":"https://'

when I run npm install

Below is my package.json file:

{
    "name": "gateway",
    "version": "0.0.0",
    "description": "Description for gateway",
    "private": true,
    "license": "UNLICENSED",
    "cacheDirectories": [
        "node_modules"
    ],
    "dependencies": {
        "@angular/common": "7.2.4",
        "@angular/compiler": "7.2.4",
        "@angular/core": "7.2.4",
        "@angular/forms": "7.2.4",
        "@angular/platform-browser": "7.2.4",
        "@angular/platform-browser-dynamic": "7.2.4",
        "@angular/router": "7.2.4",
        "@fortawesome/angular-fontawesome": "0.3.0",
        "@fortawesome/fontawesome-svg-core": "1.2.14",
        "@fortawesome/free-solid-svg-icons": "5.7.1",
        "@ng-bootstrap/ng-bootstrap": "4.0.2",
        "@ngx-translate/core": "11.0.1",
        "@ngx-translate/http-loader": "4.0.0",
        "bootstrap": "4.2.1",
        "core-js": "2.6.4",
        "moment": "2.24.0",
        "ng-jhipster": "0.9.1",
        "ngx-cookie": "2.0.1",
        "ngx-infinite-scroll": "7.0.1",
        "ngx-webstorage": "2.0.1",
        "rxjs": "6.4.0",
        "swagger-ui": "2.2.10",
        "tslib": "1.9.3",
        "zone.js": "0.8.29"
    },
    "devDependencies": {
        "@angular/cli": "7.3.1",
        "@angular/compiler-cli": "7.2.4",
        "@ngtools/webpack": "7.3.1",
        "@types/jest": "24.0.0",
        "@types/node": "10.12.24",
        "angular-router-loader": "0.8.5",
        "angular2-template-loader": "0.6.2",
        "autoprefixer": "9.4.7",
        "browser-sync": "2.26.3",
        "browser-sync-webpack-plugin": "2.2.2",
        "cache-loader": "2.0.1",
        "codelyzer": "4.5.0",
        "copy-webpack-plugin": "4.6.0",
        "css-loader": "2.1.0",
        "file-loader": "3.0.1",
        "fork-ts-checker-webpack-plugin": "0.5.2",
        "friendly-errors-webpack-plugin": "1.7.0",
        "generator-jhipster": "5.8.2",
        "html-loader": "0.5.5",
        "html-webpack-plugin": "3.2.0",
        "husky": "1.3.1",
        "jest": "24.1.0",
        "jest-junit": "6.2.1",
        "jest-preset-angular": "6.0.2",
        "jest-sonar-reporter": "2.0.0",
        "lint-staged": "8.1.3",
        "merge-jsons-webpack-plugin": "1.0.18",
        "mini-css-extract-plugin": "0.5.0",
        "moment-locales-webpack-plugin": "1.0.7",
        "optimize-css-assets-webpack-plugin": "5.0.1",
        "prettier": "1.16.4",
        "reflect-metadata": "0.1.13",
        "rimraf": "2.6.3",
        "simple-progress-webpack-plugin": "1.1.2",
        "style-loader": "0.23.1",
        "terser-webpack-plugin": "1.2.2",
        "thread-loader": "2.1.2",
        "to-string-loader": "1.1.5",
        "ts-loader": "5.3.3",
        "tslint": "5.12.1",
        "tslint-config-prettier": "1.18.0",
        "tslint-loader": "3.6.0",
        "typescript": "3.2.4",
        "postcss-loader": "3.0.0",
        "xml2js": "0.4.19",
        "webpack": "4.29.3",
        "webpack-cli": "3.2.3",
        "webpack-dev-server": "3.1.14",
        "webpack-merge": "4.2.1",
        "webpack-notifier": "1.7.0",
        "webpack-visualizer-plugin": "0.1.11",
        "workbox-webpack-plugin": "3.6.3",
        "write-file-webpack-plugin": "4.5.0"
    },
    "engines": {
        "node": ">=8.9.0"
    },
    "lint-staged": {
        "{,src/**/}*.{md,json,ts,css,scss}": [
            "prettier --write",
            "git add"
        ]
    },
    "scripts": {
        "prettier:format": "prettier --write \"{,src/**/}*.{md,json,ts,css,scss}\"",
        "lint": "tslint --project tsconfig.json -e 'node_modules/**'",
        "lint:fix": "npm run lint -- --fix",
        "ngc": "ngc -p tsconfig-aot.json",
        "cleanup": "rimraf target/{aot,www}",
        "clean-www": "rimraf target//www/app/{src,target/}",
        "start": "npm run webpack:dev",
        "start-tls": "npm run webpack:dev -- --env.tls",
        "serve": "npm run start",
        "build": "npm run webpack:prod",
        "test": "npm run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js",
        "test:watch": "npm run test -- --watch",
        "webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --env.stats=minimal",
        "webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --profile --progress --env.stats=normal",
        "webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal",
        "webpack:build": "npm run cleanup && npm run webpack:build:main",
        "webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
        "webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
        "webpack:test": "npm run test",
        "webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
        "webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"
    },
    "jestSonar": {
        "reportPath": "target/test-results/jest",
        "reportFile": "TESTS-results-sonar.xml"
    }
}

I have searched for solution and found out that running the below commands:

npm cache clean --force
npm cache verify

should solve the issue, but the issue still exits after running these commands and clearing cache.

My npm version is 6.4.1 and node version is v10.15.3

like image 795
Thanthu Avatar asked Mar 14 '19 06:03

Thanthu


1 Answers

This issue was solved by going to C:\Users\USERNAME\AppData\Roaming\npm-cache and deleting its contents manually and then later running cmd as Administrator and running npm install

NOTE: Running cmd as Administrator was to solve another error that occurred after deleting cache manually and running. The new issue was npm WARN tarball tarball data for [email protected] seems to be corrupted. which would freeze the installation at this point. On searching the internet, found out that it might be due to lack of permission, as it was since it was solved after running as Administrator.

like image 71
Thanthu Avatar answered Nov 15 '22 12:11

Thanthu