我从GitLab克隆了我的项目,我需要在我的项目中安装NPM包。
当我运行npm install
时,它显示了这个错误:
然后我去看日志文件
30601 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...19"},"dist":{"integri'
30601 verbose stack at JSON.parse (<anonymous>)
30601 verbose stack at parseJson (/usr/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
30601 verbose stack at /usr/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
30601 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
30602 verbose cwd /home/mrcoder/Projects/Angular/Ava/PFA/pfa-front-cpl
30603 verbose Linux 5.4.0-33-generic
30604 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
30605 verbose node v12.17.0
30606 verbose npm v6.14.4
30607 error Unexpected end of JSON input while parsing near '...19"},"dist":{"integri'
30608 verbose exit [ 1, true ]
这是我的package.json
:
{
"name": "vex",
"version": "9.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
},
"private": true,
"dependencies": {
"@angular/animations": "~9.0.7",
"@angular/cdk": "~9.1.3",
"@angular/common": "~9.0.7",
"@angular/compiler": "~9.0.7",
"@angular/core": "~9.0.7",
"@angular/flex-layout": "9.0.0-beta.29",
"@angular/forms": "~9.0.7",
"@angular/material": "~9.1.3",
"@angular/platform-browser": "~9.0.7",
"@angular/platform-browser-dynamic": "~9.0.7",
"@angular/router": "~9.0.7",
"@iconify/icons-emojione": "~1.0.5",
"@iconify/icons-fa-brands": "~1.0.10",
"@iconify/icons-fa-solid": "~1.0.8",
"@iconify/icons-ic": "~1.0.9",
"@iconify/icons-logos": "~1.0.9",
"@ngrx/store": "^9.1.2",
"@ngx-loading-bar/core": "~5.0.0-alpha.1",
"@ngx-loading-bar/router": "~5.0.0-alpha.1",
"@ngx-translate/core": "^12.1.2",
"@visurel/iconify-angular": "^0.0.7",
"angular-calendar": "~0.28.5",
"angular2-promise-buttons": "^4.0.6",
"apexcharts": "~3.17.0",
"color": "~3.1.2",
"date-fns": "~2.11.0",
"highlight.js": "~9.18.1",
"jalali-moment": "^3.3.3",
"luxon": "~1.22.0",
"ng2-jalali-date-picker": "^2.3.0",
"ngx-material-file-input": "^2.1.1",
"ngx-quill": "~8.1.0",
"ngx-showdown": "~5.1.0",
"ngx-take-until-destroy": "~5.4.0",
"ngx-toastr": "^12.0.1",
"quill": "~1.3.7",
"rxjs": "~6.5.4",
"showdown": "^1.9.1",
"simplebar": "~4.2.3",
"tailwindcss": "~1.2.0",
"tslib": "~1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-builders/custom-webpack": "~9.0.0",
"@angular-devkit/build-angular": "~0.900.7",
"@angular/cli": "~9.0.7",
"@angular/compiler-cli": "~9.0.7",
"@angular/language-service": "~9.0.7",
"@fullhuman/purgecss-loader": "^1.0.0",
"@types/color": "~3.0.0",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/luxon": "~1.22.0",
"@types/node": "~13.9.3",
"@types/showdown": "~1.9.3",
"@types/simplebar": "~5.1.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"postcss-loader": "~3.0.0",
"postcss-scss": "~2.0.0",
"protractor": "~5.4.0",
"tailwindcss-dir": "~4.0.0",
"ts-node": "^8.8.1",
"tslint": "~5.15.0",
"typescript": "~3.7.5"
}
}
有什么问题?我该怎么解决?
2条答案
按热度按时间fcwjkofz1#
实际上你的package-lock.json有一些问题。因为package-lock.json在json中的每个依赖项都插入了一个完整性密钥。有时json会变形/损坏,所以当npm下次读取它以确定要安装哪个版本的依赖项时,它会出现这种错误。下面给出的步骤可以解决这个问题。
1.删除软件包-lock.json。
1.删除节点模块
1.运行npm缓存清理--强制
1.运行npm安装。
vkc1a9a22#
尝试
npm cache clean --force
,然后使用npm install
重新安装。希望它能起作用!:)