在angular2 RC4中加载时出错:错误:XHR错误(404未找到)加载
当应用程序加载到浏览器上时,我遇到以下异常。请在下面查找配置文件和错误详细信息 错误 Package.json在angular2 RC4中加载时出错:错误:XHR错误(404未找到)加载,angular,Angular,当应用程序加载到浏览器上时,我遇到以下异常。请在下面查找配置文件和错误详细信息 错误 Package.json { "version": "1.0.0", "name": "ngcorecontacts", "scripts": { "postinstall": "typings install", "typings": "typings" }, "dependencies": { "
{
"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": {}
在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
}
}
我在这里错过了什么 这是因为您正在从AppScript加载应用程序,如下所述: outDir:../wwwroot/appScripts/, 但您的应用程序是指系统配置中的应用程序
快速修复方法是从tsconfig.json中删除outDir并运行应用程序。理想情况下,您应该使用@angular cli进行构建。看这是因为您正在从appScripts加载应用程序,如下所示: outDir:../wwwroot/appScripts/, 但您的应用程序是指系统配置中的应用程序 快速修复方法是从tsconfig.json中删除outDir并运行应用程序。理想情况下,您应该使用@angular cli进行构建。看,我找到了答案 您不能从wwwroot导入节点_模块,但必须在wwwroot的目标文件夹中复制捆绑包,例如通过gulp,然后通过systemjs.config.js从那里导入 AspNet core与Angular2-RC4的工作解决方案,我已在中以zip文件的形式上传,我找到了答案 您不能从wwwroot导入节点_模块,但必须在wwwroot的目标文件夹中复制捆绑包,例如通过gulp,然后通过systemjs.config.js从那里导入
AspNet core与Angular2-RC4的工作解决方案,我已在中以zip文件的形式上传,您正在尝试哪个版本-RC1或RC4?您指向2.0.0-rc.1的package.json更新了配置条目,仍然面临相同的问题,有什么想法吗?您正在尝试哪个版本-RC1或RC4?您指向2.0.0-rc.1的package.json更新了配置项,仍然面临相同的问题,有什么想法吗?更新了配置项,仍然面临相同的问题,有什么想法吗?您能提供一个演示该问题的plunker吗?在plunker中,它工作正常,配置设置和其他组件在Visual studio IDE AspNet Core RC2中放置时相同,在运行应用程序时,我遇到此错误。请从Github URL下载zip文件,从Github.com/snkrishnan1/Angular2RC4下载WebApplication1.zip文件。在这个github repo中,我使用了Quickstart教程中相同的配置,但出现了上述错误。您是否有任何使用Angular2 RC4在AspNet Core RC2上构建的工作解决方案?更新了配置条目,仍然面临相同的问题,有什么想法吗?您能否提供一个plunker来演示该问题?在plunker中,它工作良好,在Visual studio IDE AspNet Core RC2中放置相同的配置设置和其他组件,在运行应用程序时,我遇到此错误。请从Github URL下载zip文件,从Github.com/snkrishnan1/Angular2RC4下载WebApplication1.zip文件。在这个github repo中,我使用了Quickstart教程中相同的配置,但出现了上述错误。您是否有任何基于AspNet Core RC2和Angular2 RC4构建的工作解决方案?
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}