加载资源rxjs失败



我刚刚升级到rxjs 5.4.3,现在我在浏览器中得到一个错误。在我的package.json我有"rxjs": "5.4.3"安装,所以我不知道为什么我得到这个错误信息?

ts文件:

import { Injectable } from "@angular/core";
import { Subject } from "rxjs";
import { NoteDictionariesServiceModel } from "../../Models/ServiceModels/NoteServiceModels";
@Injectable()
export class NoteEditorContext {
dictionaries: NoteDictionariesServiceModel;
onContextInitialized = new Subject();
}

错误文本:

Unhandled Promise rejection: (SystemJS) XHR error (403 Forbidden) loading http://localhost:52313/node_modules/rxjs
Error: XHR error (403 Forbidden) loading http://localhost:52313/node_modules/rxjs
at XMLHttpRequest.wrapFn (http://localhost:52313/node_modules/zone.js/dist/zone.js:1332:39)
at ZoneDelegate.invokeTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:423:31)
at Zone.runTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:195:47)
at ZoneTask.invokeTask [as invoke] (http://localhost:52313/node_modules/zone.js/dist/zone.js:498:34)
at invokeTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:1744:14)
at XMLHttpRequest.globalZoneAwareCallback (http://localhost:52313/node_modules/zone.js/dist/zone.js:1770:17)
Error loading http://localhost:52313/node_modules/rxjs as "rxjs" from http://localhost:52313/dist/debug/Components/StyleGuideNoteEditor/NoteEditorContext.js ; Zone: <root> ; Task: Promise.then ; Value: (SystemJS) XHR error (403 Forbidden) loading http://localhost:52313/node_modules/rxjs
Error: XHR error (403 Forbidden) loading http://localhost:52313/node_modules/rxjs
at XMLHttpRequest.wrapFn (http://localhost:52313/node_modules/zone.js/dist/zone.js:1332:39)
at ZoneDelegate.invokeTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:423:31)
at Zone.runTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:195:47)
at ZoneTask.invokeTask [as invoke] (http://localhost:52313/node_modules/zone.js/dist/zone.js:498:34)
at invokeTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:1744:14)
at XMLHttpRequest.globalZoneAwareCallback (http://localhost:52313/node_modules/zone.js/dist/zone.js:1770:17)
Error loading http://localhost:52313/node_modules/rxjs as "rxjs" from http://localhost:52313/dist/debug/Components/StyleGuideNoteEditor/NoteEditorContext.js (SystemJS) XHR error (403 Forbidden) loading http://localhost:52313/node_modules/rxjs
Error: XHR error (403 Forbidden) loading http://localhost:52313/node_modules/rxjs
at XMLHttpRequest.wrapFn (http://localhost:52313/node_modules/zone.js/dist/zone.js:1332:39)
at ZoneDelegate.invokeTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:423:31)
at Zone.runTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:195:47)
at ZoneTask.invokeTask [as invoke] (http://localhost:52313/node_modules/zone.js/dist/zone.js:498:34)
at invokeTask (http://localhost:52313/node_modules/zone.js/dist/zone.js:1744:14)
at XMLHttpRequest.globalZoneAwareCallback (http://localhost:52313/node_modules/zone.js/dist/zone.js:1770:17)
Error loading http://localhost:52313/node_modules/rxjs as "rxjs" from http://localhost:52313/dist/debug/Components/StyleGuideNoteEditor/NoteEditorContext.js

依赖性:

"dependencies": {
"@angular/cli": "^6.2.1",
"@angular/common": "4.4.7",
"@angular/compiler": "4.4.7",
"@angular/core": "4.4.7",
"@angular/forms": "4.4.7",
"@angular/http": "4.4.7",
"@angular/platform-browser": "4.4.7",
"@angular/platform-browser-dynamic": "4.4.7",
"@angular/router": "4.4.7",
"@angular/upgrade": "4.4.7",
"a": "^2.1.2",
"angular-in-memory-web-api": "0.2.5",
"core-js": "^2.4.1",
"debug": "^4.1.1",
"gulp": "^4.0.2",
"gulp-cli": "^2.3.0",
"gulp-typedoc": "^1.2.1",
"gulp4-run-sequence": "^1.0.1",
"moment": "2.17.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.4.3",
"systemjs": "0.19.39",
"zone.js": "^0.8.4"
},

根据这个github页面,rxjs与你的angular版本兼容的版本是5.0.3

你应该降级到那样。

我建议你的clicore版本也互相兼容。

检查你的node.js版本。

该页面将帮助您找到要升级或降级到哪个版本。