将 nativescript 添加到 angular 项目后出现错误 [英] I have a error after adding nativescript to an angular project

查看:75
本文介绍了将 nativescript 添加到 angular 项目后出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可用的 Angular 项目,想尝试 NativeScript,所以我使用 npm install --global @nativescript/schematicsng add @nativescript/schematics<添加了 NativeScript/code> 但是现在当我尝试运行 ng serve 时出现此错误

I had a working angular project, and wanted to try NativeScript, so I added NativeScript to it using npm install --global @nativescript/schematics and ng add @nativescript/schematics but now when I try to run ng serve I get this error

错误 TS6053 中的错误:找不到文件C:[path]/src/src/main.ts".

ERROR in error TS6053: File 'C:[path]/src/src/main.ts' not found.

错误 TS6053:找不到文件C:[path]/src/src/polyfills.ts".

error TS6053: File 'C:[path]/src/src/polyfills.ts' not found.

我尝试删除 node_modlues,然后再次运行 npm install,但错误是一样的.我什至尝试重新启动我的终端并再次运行 ng serve 结果是一样的

I tried deleting node_modlues, and running npm install again, but the error is the same. I even tried restarting my terminal and run ng serve again and the result is the same

我做错了吗?还是我忘了做什么?

Did I do something wrong? Or did i forget to do something?

编辑

tsconfig.app.json 文件:

tsconfig.app.json file:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": [],
    "paths": {
      "@src/*": [
        "src/*.web",
        "src/*"
      ]
    }
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ],
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ]
}

推荐答案

从 files 数组中提到的路径中删除关键字 'src/' 并尝试.结帐这个 - https://github.com/NativeScript/nativescript-schematics/issues/240希望这会有所帮助.

Remove the keyword 'src/' from the paths mentioned in the files array and try. checkout this - https://github.com/NativeScript/nativescript-schematics/issues/240 Hope this helps.

这篇关于将 nativescript 添加到 angular 项目后出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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