【问题标题】:.angular-cli.json' failed.Ensure the file is valid JSON. Error: Unexpected token ] in >JSON at position.angular-cli.json' 失败。确保文件是有效的 JSON。错误:位置 >JSON 中的意外令牌]
【发布时间】:2018-06-04 03:50:39
【问题描述】:

我为我的项目安装了这个 npm install ng-file-upload ng-file-upload 现在我的项目出现了一些错误,

D:\web\ng4fbbootstrap\node_modules\@angular\cli\models\config\config.js:89 抛出新的 InvalidConfigError(common_tags_1.stripIndent ` ^

InvalidConfigError: 解析 'D:\web\ng4fbbootstrap.angular-cli.json' 失败的。确保文件是有效的 JSON。错误:意外的令牌] in 位置 515 的 JSON 在 Function.fromConfigPath (D:\web\ng4fbbootstrap\node_modules\@angular\cli\models\config\config.js:89:19) 在 Function.fromProject (D:\web\ng4fbbootstrap\node_modules\@angular\cli\models\config.js:67:46) 在对象。 (D:\web\ng4fbbootstrap\node_modules\@angular\cli\commands\build.js:10:35) 在 Module._compile (module.js:612:30) 在 Object.Module._extensions..js (module.js:623:10) 在 Module.load (module.js:531:32) 在 tryModuleLoad (module.js:494:12) 在 Function.Module._load (module.js:486:3) 在 Module.require (module.js:556:17) 在要求(内部/module.js:11:18)

package.jason

{
  "name": "ng4fbbootstrap",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.8",
    "@types/core-js": "^0.9.43",
    "@types/fullcalendar": "^3.5.1",
    "angular-bootstrap-calendar": "^0.30.0",
    "angular-calendar": "^0.22.1",
    "angular-font-awesome": "^3.0.3",
    "angular-weekly-scheduler": "0.0.5",
    "ap-angular2-fullcalendar": "^1.3.6",
    "bootstrap": "^4.0.0-beta.2",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "fullcalendar": "^3.6.2",
    "fullcalendar-ag4": "^0.1.3",
    "jquery": "^3.2.1",
    "moment": "^2.20.1",
    "ng-file-upload": "^12.2.13",
    "ng-fullcalendar": "^1.2.0",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.6.1",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2",
    "typings": "^2.1.1"
  }
}

如何解决这个问题? 请帮帮我

【问题讨论】:

  • ng-file-upload 适用于 angularjs (v1),不适用于您正在使用的 angular 版本
  • @core114​​ 解析失败的不是 package.json。但是 ng4fbbootstrap.angular-cli.json
  • 好的先生,现在它对我有用,我用这个npm install -g @angular/cli

标签: angular npm-install ng-file-upload


【解决方案1】:

我解决了我的问题
再次安装Angular

npm install -g @angular/cli 现在它为我工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-22
    • 1970-01-01
    • 2018-06-17
    • 2016-12-13
    • 2017-05-11
    • 2020-04-23
    • 1970-01-01
    相关资源
    最近更新 更多