Angular 2 - 404 traceur not found

2019-01-14 01:00发布

I've followed the starting guide and expanded a little upon for a previous angular 2 version. I've updated my revision and changed everything accordingly. When I am running the web server I now receive the error 404 for traceur... Error 404 for traceur

Here is my project structure: Project structure

Relevant files :

Index.html:

    <html>
<head>
    <title>Kinepolis HR-tool</title>

    <base href="./">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Kinepolis HR tool">
    <meta name="author" content="Jeffrey Devloo!">

    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
    <!-- CSS for PrimeUI -->

    <!-- 1. Load libraries -->
    <!-- Polyfill(s) for older browsers -->
    <script src="node_modules/es6-shim/es6-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>

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

<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>

</html>

systemjs.config.js

(function(global) {

    // map tells the System loader where to look for things
    var map = {
        'app':                        'app', // 'dist',
        'rxjs':                       'node_modules/rxjs',
        'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
        '@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' },
        '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"
  ]
}

A possible issue could be enter image description here this is boycotting my progress.

17条回答
forever°为你锁心
2楼-- · 2019-01-14 01:06

In case it helps anyone, both times I've experienced this issue, it's been caused by multiline comments (see Picci's answer here for an example).

查看更多
相关推荐>>
3楼-- · 2019-01-14 01:06

I spent up to 3 hours trying to figure out what i did wrong in my codes, i was able to find out that "Commenting a section of my codes caused the problem".

So kindly make sure that you are not commenting any of your codes outside the scope of a component

查看更多
三岁会撩人
4楼-- · 2019-01-14 01:08

The issue was that one of my services was invalid. I've added the constructor as one of the last methods for demonstrating purposes and it refused to load.

So for those that would ever encounter this error, open up the error and check the referenced files for errors. The issue is NOT that he doesn't find traceur but it is that he CANNOT load a file.

查看更多
我想做一个坏孩纸
5楼-- · 2019-01-14 01:09

@Coquelicot Gave a similar answer, but I thought I'd answer anyway since mine has a little bit more detail. I don't normally have any issues with using multi-line comments, but if I put an import statement inside of one then I get this exact error. Simply putting quotes around the import statement got rid of the error for me. Very strange.

查看更多
我想做一个坏孩纸
6楼-- · 2019-01-14 01:11

I got this error when run angular4 quickstart project on asp.net mvc. changing "es2015" to "commonjs" inside tsconfig.json solved my problem.

查看更多
Rolldiameter
7楼-- · 2019-01-14 01:11

I had this exact issue which was resolved by correcting the name of a file.

查看更多
登录 后发表回答