当我的Angular应用程序启动时(这是来自 ng服务服务器),Web控制台正在加载大量错误消息,从以下开始:
GET
http://localhost:4200/ [HTTP/1.1 304 Not Modified 1ms]
GET
http://localhost:4200/inline.bundle.js [HTTP/1.1 304 Not Modified 1ms]
GET
http://localhost:4200/polyfills.bundle.js [HTTP/1.1 304 Not Modified 1ms]
GET
http://localhost:4200/styles.bundle.js [HTTP/1.1 304 Not Modified 1ms]
GET
http://localhost:4200/vendor.bundle.js [HTTP/1.1 304 Not Modified 4ms]
GET
http://localhost:4200/main.bundle.js [HTTP/1.1 200 OK 4ms]
Error in parsing value for ‘-webkit-text-size-adjust’. Declaration dropped. localhost:4200:12:28
Unknown pseudo-class or pseudo-element ‘-webkit-inner-spin-button’. Ruleset ignored due to bad selector. localhost:4200:207:17
Unknown pseudo-class or pseudo-element ‘-webkit-search-cancel-button’. Ruleset ignored due to bad selector. localhost:4200:217:17
Unknown pseudo-class or pseudo-element ‘-webkit-file-upload-button’. Ruleset ignored due to bad selector. localhost:4200:222:2
Unknown property ‘orphans’. Declaration dropped. localhost:4200:288:11
Unknown property ‘widows’. Declaration dropped. localhost:4200:289:10
Expected color but found ‘auto’. Expected color but found ‘-webkit-focus-ring-color’. Expected end of value but found ‘-webkit-focus-ring-color’. Error in parsing value for ‘outline’. Declaration dropped.
(( several more pages of errors ))
之后,应用程序本身确实有效。我正在使用Bootstrap 4,它似乎也有效,但我认为这些错误消息与此有关。
如何找到错误以及如何解决?
package.json 如下:
$ cat package.json
{
"name": "cytable",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"bootstrap": "^4.0.0-alpha.6",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}
.angular-cli.json 文件中包含以下内容,编辑了长度:
$ cat .angular-cli.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
...
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
...
"defaults": {
"styleExt": "css",
"component": {}
}
}
指的是src / style.css文件,其中包含 bootstrap 的引用,如下所示:
$ cat src/styles.css
/*@import "../node_modules/bootstrap/dist/css/bootstrap.min.css";*/
@import "../node_modules/bootstrap/dist/css/bootstrap.css";
显然, main.bundle.js (或之前)的装配出了问题。
任何指针都非常感激。
更新:显然这是Bootstrap and Firefox之间长期存在的问题。我在不同版本的Bootstrap中复制了这个错误,并且还验证了Safari下没有出现的错误。所以我现在要放弃它。