我的错误:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (traceur, line 0)
Error: invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:323:34
runGuarded@http://localhost:3000/node_modules/zone.js/dist/zone.js:230:54
http://localhost:3000/node_modules/zone.js/dist/zone.js:206:40
Error loading http://localhost:3000/traceur
Error loading http://localhost:3000/ts/app.js
我的文件夹结构是这样的:
index.htmn
package.json
systemjs.config.js
typings.json
->ts/app.js
->node_modules/*
->typings/*
我尝试更改源应用文件的目标路径,但没有任何运气。
的index.html
<html>
<head>
<title>First App - Hello world</title>
<script src="node_modules/es6-shim/es6-shim.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').then(null, console.error.bind(console));
</script>
<body>
<gs-test></gs-test>
</body>
</html>
在systemjs.config文件中的我尝试更改我的应用程序的地图部分但仍然相同。 我也尝试过更改不同版本的库但没有帮助。
systemjs.config.js
// See also: https://angular.io/docs/ts/latest/quickstart.html
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'ts',
'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: 'app.js', defaultExtension: 'js'},
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' }
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/router-deprecated',
'@angular/testing',
'@angular/upgrade',
];
// 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
}
// filterSystemConfig - index.html's chance to modify config before we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }
System.config(config);
})(this);
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
可能是打字的东西,但我猜td文件会丢失。我在开始第一次应用之前做了“打字安装”。
typings.json
{
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
"node": "registry:dt/node#4.0.0+20160509154515"
}
}
请让我知道我的设置可能出现的问题。
TNX! 米哈