首页 > 解决方案 > 将 Angular 10 项目转换为 nativescript 共享项目时出现“无法解析 tsconfig.json 文件”错误

问题描述

我首先将 Angular 8 项目更新到 Angular 9,然后是 Angular 10。在成功更新到 10 并运行 ng serve 以确保应用程序仍然正常工作后,我遵循了 nativescript 迁移步骤here

进入添加@nativescript/schematics 的步骤时,我收到以下错误“无法解析文件 tsconfig.json!”。

我看到了这个stackoverflow问题并将我的 tsconfig.json 插入编译器,但仍然无法找出导致错误的原因。所有括号似乎都直接关闭。

非常感谢您对此的任何帮助!下面是我的 tsconfig.json 中的代码:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

标签: angulartypescriptnativescript

解决方案


最终成为 , 在单个“lib”数组之后。仅仅是一个 JSON 问题,与 angular / nativescript 迁移无关。

希望这可以帮助遇到这个简单但愚蠢的错误的其他人。干杯!


推荐阅读