带有Angular4应用程序的RXJS突然出现问题。 '找不到运营商.js'

时间:2017-11-09 16:21:14

标签: angular npm rxjs systemjs

我的Angular4应用程序突然出现问题,我收到以下错误消息:

GET http://degould-login.dev/node_modules/rxjs/operators.js 404 (Not Found)

我不确定它为什么突然出现,我在包或核心架构中没有改变任何可能导致此问题的内容。

我可以看到'operator'js'文件不存在于npm:rxjs文件夹中,但我不知道是在请求它。

我的System.JS文件

 /**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
    System.config({
        paths: {
            // paths serve as alias
            'npm:': 'node_modules/'
        },
        // map tells the System loader where to look for things
        map: {
            // our app is within the app folder
            app: 'app',
            // angular bundles
            '@angular/animations': 'node_modules/@angular/animations/bundles/animations.umd.min.js',
            '@angular/animations/browser':'node_modules/@angular/animations/bundles/animations-browser.umd.js',
            '@angular/platform-browser/animations': 'node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
            '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
            '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
            '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
            '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
            '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
            '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
            '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
            '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
            // other libraries
            'rxjs'                       : 'npm:rxjs',
            '@ngrx'                      : 'node_modules/@ngrx',
            'angular2-jwt'               : 'node_modules/angular2-jwt',
            'd3'                         : 'npm:d3',
            'ng2-charts'                 : 'npm:ng2-charts',
            'chart.js'                   : 'npm:chart.js',
            '@agm/core'                  : 'npm:@agm'
        },
        // packages tells the System loader how to load when no filename and/or no extension
        packages: {
            app: {
                main: './main.js',
                defaultExtension: 'js'
            },
            'rxjs': {
                defaultExtension: 'js'
            },
            '@ngrx/store': {
                main: 'bundles/store.umd.js',
                format: 'cjs'
            },
            '@ngrx/core': {
                main: 'bundles/core.umd.js',
                format: 'cjs'
            },
            '@ngrx/store-devtools': {
                main: 'bundles/store-devtools.umd.js',
                format: 'cjs'
            },
            'angular2-jwt': {
                main: 'angular2-jwt.js',
                format: 'js'
            },
            'd3': {
                main: 'build/d3.js',
                defaultExtension: 'js'
            },
            'ng2-charts': {
                main: 'bundles/ng2-charts.umd.js',
                defaultExtension: 'js'
            },
            'chart.js': {
                main: 'dist/Chart.bundle.js',
                defaultExtension: 'js'
            },
            '@agm/core': {
                main: 'core/core.umd.js',
                defaultExtension: 'js'
            }
        }
    });
})(this);

和我的package.json

{
  "name": "degould-dashboard-frontend",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run build-css-watch\"",
    "build": "tsc",
    "tsc:w": "tsc -w",
    "build-css": "node-sass --include-path scss assets/css -o app/assets/css",
    "build-css-watch": "node-sass --include-path scss assets/css -wo app/assets/css",
    "test": "concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "testnotsc": "karma start karma.conf.js"
  },
  "license": "ISC",
  "dependencies": {
    "@agm/core": "^1.0.0-beta.1",
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/platform-server": "4.0.0",
    "@angular/router": "^4.2.4",
    "@angularclass/conventions-loader": "^1.0.2",
    "@angularclass/hmr": "~1.2.2",
    "@angularclass/hmr-loader": "~3.0.2",
    "@ngrx/core": "^1.2.0",
    "@ngrx/store": "^2.2.1",
    "@ngrx/store-devtools": "^3.2.4",
    "@types/chart.js": "^2.6.1",
    "angular-2-local-storage": "^1.0.1",
    "angular2-jwt": "^0.2.3",
    "bootstrap": "^3.3.7",
    "chart.js": "^2.6.0",
    "core-js": "^2.4.1",
    "d3": "^4.10.0",
    "heatmap.js": "^2.0.5",
    "jquery": "^3.2.1",
    "moment": "^2.18.1",
    "ng2-charts": "^1.6.0",
    "redux": "^3.6.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "^5.5.2",
    "sass": "^0.5.0",
    "systemjs": "0.19.39",
    "tether": "^1.4.0",
    "toastr-ng2": "^4.1.1",
    "weather-icons": "^1.3.2",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/compiler-cli": "2.4.6",
    "@types/d3": "^4.10.0",
    "@types/jasmine": "^2.5.36",
    "concurrently": "^2.2.0",
    "gulp": "^3.9.1",
    "gulp-coffee": "latest",
    "gulp-concat": "latest",
    "gulp-connect": "latest",
    "gulp-sass": "latest",
    "gulp-typescript": "^3.0.2",
    "gulp-uglify": "latest",
    "gulp-useref": "^3.1.2",
    "gulp-util": "latest",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^4.0.9",
    "typescript": "2.4.1",
    "typings": "^1.3.2"
  }
}

有谁知道为什么我会收到此错误?我重新安装了我的npm软件包,我也手动重新安装了rxjs。

由于

2 个答案:

答案 0 :(得分:-1)

我从package.json看到你有angular / cli。你在用它吗?

如果是这样,常见的帖子表明angular / cli不需要systemjs。你有这个原因有什么特别的原因吗?

如果这是最初的systemjs,现在是angular / cli,请参阅Move project from SystemJS to Angular CLI / Webpack

如果你想保留systemjs,直接解决问题,

我注意到GET http://degould-login.dev/node_modules/rxjs/operators.js - rxjs包中没有operators.js,其中有一个运营商文件夹。
所以这可能与导入声明有一个流氓' .js'?

有关

答案 1 :(得分:-1)

当我回答另一个问题时(使用Plunker& SystemJs),这个错误突然出现。

这是在Plunker上运行的systemjs.config.js rxjs映射条目。请注意,订单可能很重要。

// other libraries
'rxjs/operators':            'npm:rxjs@5.5.2/operators/index.js',
'rxjs':                      'npm:rxjs@5.5.2',