运行时错误CSS1062:预期的分号或右花括号,找到'-'Bootstrap 4.4.1:root?

问题描述 投票:0回答:1

我正在从本地托管Windows Server 2012 R2的Asp.Net MVC项目。当我尝试使用网站URL打开它时。我收到这样的运行时错误;

运行时错误CSS1062:预期的分号或右花括号,找到'-'

当我进行详细搜索时,我发现该错误是由名为bootstrap.min css的样式文件引起的。该文件取自bootstrap的官方网站。在文件的第7行中:在存在名为root的颜色代码的部分中,它给出了'-'字符的错误。

/*!
* Bootstrap v4.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT 
(https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
:root {
--blue: #007bff;
--indigo: #6610f2;
--purple: #6f42c1;
--pink: #e83e8c;
--red: #dc3545;
--orange: #fd7e14;
--yellow: #ffc107;
--green: #28a745;
--teal: #20c997;
--cyan: #17a2b8;
--white: #fff;
--gray: #6c757d;
--gray-dark: #343a40;
--primary: #007bff;
--secondary: #6c757d;
--success: #28a745;
--info: #17a2b8;
--warning: #ffc107;
--danger: #dc3545;
--light: #f8f9fa;
--dark: #343a40;
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
--font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
 --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

运行时错误;

(6,10): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,25): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,42): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,59): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,74): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,88): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,105): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,122): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
...
...
css twitter-bootstrap bootstrap-4 runtime-error stylesheet
1个回答
0
投票

您与BuildBunlderMinifier的损坏版本或使用NUglify的损坏版本捆绑在一起。

相关的github线程:


也就是说问题不直接是Bootstrap的,并且Bootstrap的CSS不包含错误。它只包含您的浏览器最有可能支持的CSS变量。您会遇到[[在内部使用CSS变量使用任何CSS文件都存在相同的问题(这是Bootstrap的情况)。

更新VS应该可以解决您的问题。


供将来参考,

搜索错误的相关部分

是查找大多数编码错误原因的非常有效的方法,在这种情况下,肯定会有所帮助。请花时间阅读How much research effort is expected from StackOverflow users
© www.soinside.com 2019 - 2024. All rights reserved.