Rxjs: Error looking for rxjs - 403 (Forbidden) (Angular 6, rxjs 6.1.0)

Created on 11 May 2018  路  6Comments  路  Source: ReactiveX/rxjs

I developed ASP.NET MVC 5 single page application using Angular 5. Then I updated versions of packages in package.json to Angular 6 and latest rxjs ("rxjs": "6.1.0") and restored latest packages. When I run application I get error:

GET http://localhost:8689/node_modules/rxjs/ 403 (Forbidden)

How to configure systemjs.config.js in the correct way to make application work?

needs info

Most helpful comment

i have changed the package part of system.config.js and it works for me .

packages: {
app: { main: 'main.js', defaultExtension: 'js' },
app: { defaultExtension: 'js', },
rxjs: { defaultExtension: 'js', main: "index.js" },
"rxjs-compat": { defaultExtension: 'js', main: "index.js" },
"rxjs/operators": { "main": "index.js", "defaultExtension": "js" },
"rxjs/internal-compatibility": { "main": "index.js", "defaultExtension": "js" },
"rxjs/testing": { "main": "index.js", "defaultExtension": "js" },
'rxjs/ajax': { main: 'index.js', defaultExtension: 'js' },
'rxjs/webSocket': { main: 'index.js', defaultExtension: 'js' },
'..': { defaultExtension: 'js' }
}

All 6 comments

I'm afraid I'm not a SystemJS expert. Pinging @robwormald @jasonaden for their expertise.

I think they're going to need a LOT more information though. Perhaps a minimal reproduction in a repository of what you've got going on. This might even be something that's more suitable for StackOverflow

Here鈥檚 a sample from the angular repo that uses the UMD packages, should get you started : https://github.com/angular/angular/blob/master/integration/hello_world__systemjs_umd/src/systemjs.config.js

I added:

rxjs: { main: 'index.js', defaultExtension: 'js' },
'rxjs/operators': { main: 'index.js', defaultExtension: 'js' },

to systemjs.config.js and app works.

i have changed the package part of system.config.js and it works for me .

packages: {
app: { main: 'main.js', defaultExtension: 'js' },
app: { defaultExtension: 'js', },
rxjs: { defaultExtension: 'js', main: "index.js" },
"rxjs-compat": { defaultExtension: 'js', main: "index.js" },
"rxjs/operators": { "main": "index.js", "defaultExtension": "js" },
"rxjs/internal-compatibility": { "main": "index.js", "defaultExtension": "js" },
"rxjs/testing": { "main": "index.js", "defaultExtension": "js" },
'rxjs/ajax': { main: 'index.js', defaultExtension: 'js' },
'rxjs/webSocket': { main: 'index.js', defaultExtension: 'js' },
'..': { defaultExtension: 'js' }
}

facing same issue, please help
image

package.josn
{
"name": "firstone",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"core-js": "^2.5.7",
"rxjs": "^6.2.2",
"systemjs": "^0.21.4",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@types/node": "^10.5.5",
"gulp": "^3.9.1",
"gulp-cli": "^1.3.0",
"gulp-sourcemaps": "^2.6.0",
"gulp-typescript": "^3.1.6",
"http-server": "^0.11.1",
"typescript": "^3.0.1"
}
}

systemjs.config.js

(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/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',
        '@angular/cdk/rxjs': 'npm:@angular/cdk/bundles/cdk-rxjs.umd.js',



        // other libraries
        'rxjs': 'npm:rxjs',

        'rxjs/operators': 'npm:rxjs/operators/index.js'
    },

    // 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',
        }

    }
});

})(this);

As this isn't an issue with the RxJS library itself, and more in the realm of configuring SystemJS, I'm going to close this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OliverJAsh picture OliverJAsh  路  3Comments

shenlin192 picture shenlin192  路  3Comments

Agraphie picture Agraphie  路  3Comments

peterbakonyi05 picture peterbakonyi05  路  4Comments

benlesh picture benlesh  路  3Comments