2016-11-14 4 views
0

Versuch ng2-scrollreveal npm in meiner Angular2 App zu nutzen, nachdem alle Anweisungen befolgen erhalte ich Konsole Fehler:NG2-scrollreveal 404 Not Found

zone.js:1274 GET http://localhost:3000/ng2-scrollreveal 404 (Not Found) 

und

(index):18 Error: Error: XHR error (404 Not Found) loading http://localhost:3000/ng2-scrollreveal(…) 

index.html

<html> 
<head> 
<base href="/"> 
<title>App</title> 
<meta charset="UTF-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<link rel="stylesheet" href="app/assets/css/styles.css"> 
<link rel="stylesheet" href="app/assets/css/bootstrap-grid.css"> 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.css" /> 

<script src="node_modules/core-js/client/shim.min.js"></script> 
<script src="node_modules/zone.js/dist/zone.js"></script> 
<script src="node_modules/reflect-metadata/Reflect.js"></script> 
<script src="node_modules/systemjs/dist/system.src.js"></script> 

<script src="systemjs.config.js"></script> 
<script> 
    System.import('app').catch(function(err){ console.error(err); }); 
</script> 
<script src="app/script/script.js"></script> 
</head> 

<my-app> 
    <div class="preloader"> 

    </div> 
</my-app> 

package.json

{ 
"name": "app", 
"version": "1.0.0", 
"scripts": { 
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
}, 
"license": "ISC", 
"dependencies": { 
    "@angular/common": "2.0.0", 
    "@angular/compiler": "2.0.0", 
    "@angular/core": "2.0.0", 
    "@angular/forms": "2.0.0", 
    "@angular/http": "2.0.0", 
    "@angular/platform-browser": "2.0.0", 
    "@angular/platform-browser-dynamic": "2.0.0", 
    "@angular/router": "3.0.0", 
    "@angular/upgrade": "2.0.0", 
    "angular2-in-memory-web-api": "0.0.20", 
    "bootstrap": "^3.3.6", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "5.0.0-beta.12", 
    "scrollreveal": "^3.3.2", 
    "ng2-scrollreveal": "^1.0.0", 
    "systemjs": "0.19.27", 
    "zone.js": "^0.6.23" 
}, 
    "devDependencies": { 
    "browser-sync": "^2.16.0", 
    "concurrently": "^2.2.0", 
    "lite-server": "^2.2.2", 
    "typescript": "^2.0.2", 
    "typings": "^1.3.2" 
} 
} 

system.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', 
     // other libraries 
     'rxjs': 'npm:rxjs', 
     'angular-in-memory-web-api': 'npm:angular-in-memory-web-api' 
    }, 
    // 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' 
     }, 
     'angular-in-memory-web-api': { 
     main: './index.js', 
     defaultExtension: 'js' 
     } 
    } 
    }); 
})(this); 

app.module.ts

012.
import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { NgsRevealModule } from 'ng2-scrollreveal'; 
import { AppComponent } from './app.component'; 

import { AppRoutingModule, routingComponents } from './app.routing'; 

@NgModule({ 
    imports:  [ NgsRevealModule.forRoot(), BrowserModule, AppRoutingModule ], 
    declarations: [ AppComponent, routingComponents ], 
    bootstrap: [ AppComponent ] 
}) 
export class AppModule { } 

Ähnliche Probleme mit anderen Modulen gefunden, aber vorgeschlagene Lösungen funktionierte nicht für mich. Was wurde falsch gemacht?

Antwort

0

Die Sache ist die, dass meine system.config.js Datei nicht NG2-scrollreveal im Karte Methode nicht hinzugefügt:

'ng2-scrollreveal': 'npm:ng2-scrollreveal/bundles/ng2-scrollreveal.min.js' 

Die Variante, die mir funktioniert sieht wie folgt aus:

system.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', 
     // other libraries 
     'ng2-scrollreveal': 'npm:ng2-scrollreveal/bundles/ng2-scrollreveal.min.js', 
     'rxjs': 'npm:rxjs', 
     'angular-in-memory-web-api': 'npm:angular-in-memory-web-api' 
    }, 
    // 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' 
     }, 
     'angular-in-memory-web-api': { 
     main: './index.js', 
     defaultExtension: 'js' 
     } 
    } 
    }); 
})(this); 
Verwandte Themen