Getting error on loading in angular2 RC4: Error: XHR error (404 Not Found) loading

608 views
Skip to first unread message

Navaneetha Krishnan S

unread,
Jul 5, 2016, 3:15:52 PM7/5/16
to AngularJS

I am getting the following exception when the application is loading on the browser. Please find the config files and error details below.

Error

Failed to load resource: the server responded with a status of 404 (Not Found)
http
://localhost:59856/node_modules/@angular/core/index.js Failed to load resource: the server responded with a status of 404 (Not Found) localhost/:17
Error: Error: XHR error (404 Not Found) loading http://localhost:59856/node_modules/@angular/core/index.js at XMLHttpRequest.wrapFn [as _onreadystatechange] (https://npmcdn.com/zon...@0.6.12?main=browser:769:30) at ZoneDelegate.invokeTask (https://npmcdn.com/zon...@0.6.12?main=browser:356:38) at Zone.runTask (https://npmcdn.com/zon...@0.6.12?main=browser:256:48) at XMLHttpRequest.ZoneTask.invoke (https://npmcdn.com/zon...@0.6.12?main=browser:423:34)
Error loading http://localhost:59856/node_modules/@angular/core/index.js as "@angular/core" from http://localhost:59856/app/main.js(anonymous function) @ localhost/:17 http://localhost:59856/node_modules/@angular/platform-browser-dynamic/index.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:59856/styles.css
Failed to load resource: the server responded with a status of 404 (Not Found)

Package.json

      {
      "version": "1.0.0",
      "name": "ngcorecontacts",
      "scripts": {
        "postinstall": "typings install",
        "typings": "typings"
      },
      "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2",

    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",

    "bootstrap": "^3.3.6"
  },
    "devDependencies": {
        "concurrently": "^2.0.0",
        "lite-server": "^2.2.0",
        "tslint": "^3.7.4",
        "typescript": "^1.8.10",
        "typings": "^1.0.4"
    },
    "repository": {}

In Systemjs.Config.js

 /**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {

    // map tells the System loader where to look for things
    var map = {
        'app': 'app',
        'rxjs': 'node_modules/rxjs',
        '@angular': 'node_modules/@angular'
    };

    // packages tells the System loader how to load when no filename and/or no extension
    var packages = {
        'app': { main: 'main.js', defaultExtension: 'js' },
        'rxjs': { defaultExtension: 'js' }
    };

    var packageNames = [
      '@angular/common',
      '@angular/compiler',
      '@angular/core',
      '@angular/forms',
      '@angular/http',
      '@angular/platform-browser',
      '@angular/platform-browser-dynamic',
      '@angular/router'
    ];

    // add package entries for angular packages in the form 
    // '@angular/common': { main: 'index.js', defaultExtension: 'js' }
    packageNames.forEach(function (pkgName) {
        packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
    });

    var config = {
        map: map,
        packages: packages
    };

    System.config(config);

})(this);

tsconfig.json

 {
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

What is it I am missing here?

Lucas Lacroix

unread,
Jul 5, 2016, 3:28:35 PM7/5/16
to ang...@googlegroups.com
Best guess: your node_modules folder in not accessible from your webserver.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH
Reply all
Reply to author
Forward
0 new messages