在“..."、“tarball"附近解析时出现意外的 JSON 输入结尾错误:“https://" [英] error Unexpected end of JSON input while parsing near '...","tarball":"https://'

查看:74
本文介绍了在“..."、“tarball"附近解析时出现意外的 JSON 输入结尾错误:“https://"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了

错误在解析附近时出现意外的 JSON 输入结束'...","tarball":"https://'

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

当我运行 npm install

下面是我的 package.json 文件:

{
    "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.

我的 npm 版本是 6.4.1和节点版本是 v10.15.3

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

推荐答案

此问题已通过转到 C:\Users\USERNAME\AppData\Roaming\npm-cache 并手动删除其内容来解决然后以管理员身份运行cmd并运行npm install

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

注意: 以管理员身份运行 cmd 是为了解决手动删除缓存并运行后发生的另一个错误.新问题是 npm WARN tarball tarball data for typescript@3.2.4 似乎已损坏. 此时会冻结安装.上网查了一下,发现可能是权限不够,原来是管理员运行后解决的.

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 typescript@3.2.4 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.

这篇关于在“..."、“tarball"附近解析时出现意外的 JSON 输入结尾错误:“https://"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆