错误 TS5014:无法解析文件 '':JSON 中位置 0 的意外标记 u.终端进程以退出代码终止:1 [英] error TS5014: Failed to parse file '': Unexpected token u in JSON at position 0. The terminal process terminated with exit code: 1

查看:73
本文介绍了错误 TS5014:无法解析文件 '':JSON 中位置 0 的意外标记 u.终端进程以退出代码终止:1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误.

error TS5014: Failed to parse file '/Users/Documents/tsconfig.json/tsconfig.json': Unexpected token u in JSON at position 0.
The terminal process terminated with exit code: 1

我的系统设置:

  1. Visual Studio 代码 1.14.1 版
  2. 角 2
  3. 节点版本 v8.0.0
  4. tsc 2.4.1 版

package.json 如下

package.json is as follows

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "lite-server",
    "pree2e": "webdriver-manager update",
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "test-once": "tsc && karma start karma.conf.js --single-run",
    "tsc": "tsc",
    "tsc:w": "tsc -w"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/common": "^2.4.10",
    "@angular/compiler": "^2.4.10",
    "@angular/core": "^2.4.10",
    "@angular/forms": "^2.4.10",
    "@angular/http": "^2.4.10",
    "@angular/platform-browser": "^2.4.10",
    "@angular/platform-browser-dynamic": "^2.4.10",
    "@angular/router": "^3.4.10",
    "angular-in-memory-web-api": "^0.2.5",
    "core-js": "^2.4.1",
    "rxjs": "^5.4.2",
    "systemjs": "^0.19.47",
    "zone.js": "^0.7.8"
  },
  "devDependencies": {
    "@types/jasmine": "^2.5.41",
    "@types/node": "^6.0.46",
    "canonical-path": "0.0.2",
    "concurrently": "^3.5.0",
    "http-server": "^0.9.0",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.3.0",
    "lodash": "^4.16.4",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",
    "tslint": "^3.15.1",
    "typescript": "2.1.6"
  },
  "repository": {}
}

tsconfig.json 如下

tsconfig.json is as follows

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "dist"
  }
}

推荐答案

您是如何定义 tasks.json 的?当我使用默认打字稿类型定义我的 tasks.json 时,我遇到了同样的问题.根据 链接

How did you define your tasks.json? I encountered the same issue when I defined my tasks.json with default typescript type. Following changes in tasks.json worked for me based on the answer in link

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
    {
        "taskName": "compile",
        "type": "shell",
        "command": "tsc -p tsconfig.json",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "problemMatcher": []
    }
]
}

这篇关于错误 TS5014:无法解析文件 '':JSON 中位置 0 的意外标记 u.终端进程以退出代码终止:1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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