Typescript 错误TS5014:未能分析文件“tsconfig.json”:json中的位置57处出现意外标记/
我把我的打字脚本项目移到了Win7电脑上。 当tsconfig在我的win 10计算机中运行得非常好时,我出现了这个错误。 我按照建议删除了最后两个尾随逗号,错误仍然存在 我的tsconfig:Typescript 错误TS5014:未能分析文件“tsconfig.json”:json中的位置57处出现意外标记/,typescript,tsconfig,Typescript,Tsconfig,我把我的打字脚本项目移到了Win7电脑上。 当tsconfig在我的win 10计算机中运行得非常好时,我出现了这个错误。 我按照建议删除了最后两个尾随逗号,错误仍然存在 我的tsconfig: { "compileOnSave": true, "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ /* B
{
"compileOnSave": true,
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"strict": true, /* Enable all strict type-checking options. */
// "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
//"inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
//"inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
"sourceMap": true,
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"outDir": "./src/ts-built",
//"rootDir": "./src",
// "strictNullChecks": false,
"baseUrl": "src",
"allowJs": true,
"downlevelIteration": true
}
}
当我跑步的时候,我也很惊讶
tsc --init
我获得:
错误TS5023:未知的编译器选项“init”
谢谢您的帮助。我一直收到相同的错误消息,因为我在全球安装了tsc。我卸载了它并安装了typescript软件包,解决了这个问题。我一直收到相同的错误消息,因为我在全球安装了tsc。我卸载了它并安装了typescript软件包,解决了这个问题。我遇到了这个问题,它的发生是因为我降级了我的typescript。在那之后,我删除了tsconfig.json文件,然后tsc工作了。可能在较新版本的Typescript中添加了一些新配置。因此,我开始想一想,这是新增加的:
error TS5023: Unknown compiler option 'strict'.
error TS6046: Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'esnext'
error TS5023: Unknown compiler option 'resolveJsonModule'.
error TS5023: Unknown compiler option 'checkJs'.
error TS5023: Unknown compiler option 'esModuleInterop'.
error TS5023: Unknown compiler option 'exclude'.
error TS5023: Unknown compiler option 'include'.
然后就解决了。有一个很好的提示,我已经在更新版本的typescript和它们的工作环境中使用这些配置好几个星期了
检查一下,看看会发生什么:我遇到了这个问题,这是因为我降级了我的打字脚本。在那之后,我删除了tsconfig.json文件,然后tsc工作了。可能在较新版本的Typescript中添加了一些新配置。因此,我开始想一想,这是新增加的:
error TS5023: Unknown compiler option 'strict'.
error TS6046: Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'esnext'
error TS5023: Unknown compiler option 'resolveJsonModule'.
error TS5023: Unknown compiler option 'checkJs'.
error TS5023: Unknown compiler option 'esModuleInterop'.
error TS5023: Unknown compiler option 'exclude'.
error TS5023: Unknown compiler option 'include'.
然后就解决了。有一个很好的提示,我已经在更新版本的typescript和它们的工作环境中使用这些配置好几个星期了
检查它,看看会发生什么:您是否运行了npm installJSON,因为它不能包含注释,所以文本JSON实现将因该错误而失败。一些JSON配置友好的读者会允许使用JS风格的注释。还要确保实现理解//和/*..*/表单。有些人只理解一种JS风格的注释。我怀疑这个JSON阅读器两种形式都不懂。。请参阅声称或暗示允许使用JS风格注释的文档/资源。如果找不到这些文件,它们可能是无效的。同样,纯JSON没有或不支持注释。这也是我发现纯JSON不适合配置的原因之一。。另一个是不确定的顺序,另一个是字符串中缺少文字新行,还有..我不知道JSON不能包含注释。在我的另一台电脑上没有任何问题。这就是问题所在,非常感谢。如果您以aswer的形式发布,我将接受您运行的npm installJSON不能包含注释,因此文本JSON实现将因该错误而失败。一些JSON配置友好的读者会允许使用JS风格的注释。还要确保实现理解//和/*..*/表单。有些人只理解一种JS风格的注释。我怀疑这个JSON阅读器两种形式都不懂。。请参阅声称或暗示允许使用JS风格注释的文档/资源。如果找不到这些文件,它们可能是无效的。同样,纯JSON没有或不支持注释。这也是我发现纯JSON不适合配置的原因之一。。另一个是不确定的顺序,另一个是字符串中缺少文字新行,还有..我不知道JSON不能包含注释。在我的另一台电脑上没有任何问题。这就是问题所在,非常感谢。如果你把它作为回答,我会接受的