将 nativescript 添加到 angular 项目后出现错误 [英] I have a error after adding nativescript to an angular project
问题描述
我有一个可用的 Angular 项目,想尝试 NativeScript,所以我使用 npm install --global @nativescript/schematics
和 ng 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屋!