简体   繁体   English

Tsconfig Build:' - lib'选项的参数必须是:'es5'

[英]Tsconfig Build:Argument for '--lib' option must be: 'es5'

Attempting to build an angular 7 application in visual studio and receiving an exception regarding the tsconfig.json lib version. 试图在visual studio中构建一个角度7应用程序并接收有关tsconfig.json lib版本的异常。

Below is the current tsconfig.json 下面是当前的tsconfig.json

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

Build Error 构建错误

 Severity Code Description Project File Line Suppression State Error Build:Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string' DocumentLibraryWeb C:\\Users\\Tim\\Source\\Repos\\project-sparkle\\Athena\\DocumentLibraryWeb\\tsc 

Debugging 调试

 Severity Code Description Project File Line Suppression State Error Build:Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string' DocumentLibraryWeb C:\\Users\\Tim\\Source\\Repos\\project-sparkle\\Athena\\DocumentLibraryWeb\\tsc 

es2018 is not mentioned in this list. 此列表中未提及es2018 It is however a valid option in current TypeScript. 但它是当前TypeScript中的有效选项。

Fix 固定

TypeScript version being used by visual studio is clearly the wrong version. Visual Studio使用的TypeScript版本显然是错误的版本。

Quickest fix, guaranteed to work, would be to do a vs reinstall / project reinitialisation. 最快的修复,保证工作,将是重新安装/项目重新初始化。

I managed to get this to compile by disabling the visual studio typescript compiler. 我设法通过禁用visual studio typescript编译器来编译它。 To disable using the following: 要禁用使用以下内容:

Add the property true to a PropertyGroup in your csproj file (I added it under the Configuration label). 将属性true添加到csproj文件中的PropertyGroup(我在Configuration标签下添加了它)。 This should disable all msbuild based TS compilation. 这应该禁用所有基于msbuild的TS编译。

With this setting enabled you shouldn't need the tsconfig.json settings compileOnSave/buildOnSave. 启用此设置后,您不需要tsconfig.json设置compileOnSave / buildOnSave。

If you are on an older version of Visual Studio (I had implicitly thought about VS 2017 or xproj with 2015), the property may be false. 如果您使用的是较旧版本的Visual Studio(我曾暗中考虑过VS 2017或xproj与2015),则该属性可能为false。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取错误属性参数必须是常量表达式 - Getting error attribute argument must be constant expression ASP.NET MVC-属性参数必须是常量表达式 - ASP.NET MVC - An attribute argument must be a constant expression $ location#search()调用的第一个参数必须是字符串或对象 - The first argument of the `$location#search()` call must be a string or an object 构建错误:您必须添加对 System.Runtime 的引用 - Build error: You must add a reference to System.Runtime /langversion 的选项“7.3”无效; 必须是 ISO-1、ISO-2、默认值或 1 到 6 范围内的整数 - Invalid option '7.3' for /langversion; must be ISO-1, ISO-2, Default or an integer in range 1 to 6 属性参数必须是属性参数类型的常量表达式,typeof表达式或数组创建表达式 - An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type 自定义视图模型数据注释错误:属性参数必须为常量表达式, - Customizing view model data-annotation error : An attribute argument must be a constant expression, CS1617:/langversion 的选项“6”无效; 必须是 ISO-1、ISO-2、3、4、5 或默认 - CS1617: Invalid option ‘6’ for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default 带有 Linux Docker 的 ASP.NET 自动生成“服务'无法构建:复制失败:stat /var/lib/docker/tmp/docker-builder” - ASP.NET with Linux Docker autogenerated "Service 'failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder" ASP.NET MVC4:属性参数必须是属性参数类型的常量表达式,typeof表达式或数组创建表达式 - ASP.NET MVC4: An attribute argument must be a constant expression , typeof expression or array creation expression of an attribute parameter type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM