Netbeans app.component.ts不在tsconfig.json定义的项目中
所以我得到了这个错误: 文件C:/wamp/www/angular2\u demo/GiphySearch/src/app/app.component.ts是 不在由定义的项目中 C:/wamp/www/angular2_demo/GiphySearch/e2e/tsconfig.json 我的文件夹结构是Netbeans app.component.ts不在tsconfig.json定义的项目中,netbeans,angular,typescript,Netbeans,Angular,Typescript,所以我得到了这个错误: 文件C:/wamp/www/angular2\u demo/GiphySearch/src/app/app.component.ts是 不在由定义的项目中 C:/wamp/www/angular2_demo/GiphySearch/e2e/tsconfig.json 我的文件夹结构是 / /e2e/tsconfig.json /src (others) tsconfig.js包含此内容 { "compileOnSave": false, "compilerOpt
/
/e2e/tsconfig.json
/src
(others)
tsconfig.js包含此内容
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
}
}
我尝试将
rootDir
或sourceRoot
更改为定义为。/
或。/src
或/src
,但没有任何效果。应如何正确配置?如tsconfig.json上所定义:
目录中存在tsconfig.json文件表示该目录是TypeScript项目的根目录
根据上面的链接,您的tsconfig.json
位于e2e目录中,而不是src目录中
我还注意到您有
“sourceRoot”:“/”,
会将其更改为/
帮助?我也遇到了同样的问题,我将的“outDir”:“
替换为的“outDir”:“
”
这是我当前的tsconfig.json
:
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "",
"rootDir": "./_src/",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"moduleResolution": "node",
"noImplicitAny": false
},
"include" : [
"_src/**/*"
],
"exclude": [
"node_modules"
]
}
看看这个!这对我有用
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"../src/app/app.component.ts",
"../src/app/app.component.spec.ts",
"../src/app/app.module.ts"
]
}
NetBeans项目可能被设置为将整个ng2 cli目录作为单个源根进行索引,这会破坏此插件,因为它下面有多个tsconfig.json文件(一个在src/中,一个在e2e/中)
在项目属性中的“源”类别下,将“站点根文件夹”和“源文件夹”设置为src。(如果您还想编辑“Selenium Tests Folder”,也可以将其设置为e2e)。您尝试过
/src
?My angular cli生成的tsconfig位于/src内,仅包含“mapRoot”:“/”
不确定为什么在e2e文件夹中生成angular cli。我甚至不明白那个文件夹是关于什么的。谢谢我有类似的问题,我刚刚添加了排除和编译保存,它开始正常工作!!!谢谢!对于包含多个tsconfig文件的项目,这是正确的答案。然后,配置文件似乎不再可以从“项目”选项卡访问,因此它们必须通过“文件”选项卡(Windows>文件)访问。是的,它的工作原理可以解释你到底在做什么。