Javascript Angular2 typescript的环境问题

Javascript Angular2 typescript的环境问题,javascript,angular,typescript,environment,Javascript,Angular,Typescript,Environment,Angular2 typescript的环境问题 我无法运行angular2项目。 Typescript编译器没有错误 浏览器控制台中只有错误 这是我的错误控制台: <!DOCTYPE html> <html> <head> <base href="/"></base> <title>Angular</title> <link rel="stylesheet" hr

Angular2 typescript的环境问题

我无法运行angular2项目。 Typescript编译器没有错误

浏览器控制台中只有错误

这是我的错误控制台:

 <!DOCTYPE html>
 <html>
   <head>
     <base href="/"></base>
     <title>Angular</title>

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">

     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>

     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>

     <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script>    

     <script>
         System.config({
             transpiler: 'typescript',
             defaultJSExtensions: true
         });
     </script>

     <!--<script src="angular2.dev.js"></script>
     <script src="router.dev.js"></script>
     <script src="http.js"></script>
     <script src="firebase/firebase.js"></script>-->  

     <script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
     <script src="../node_modules/angular2/bundles/router.dev.js"></script>
     <script src="../node_modules/angular2/bundles/http.js"></script>
     <script src="/src/firebase/firebaseNew.js"></script>  

   </head>

   <body class="container">
     <app></app>
     <script>
       /*System.import('app/app');*/
       System.import('src/app/app');
     </script>
   </body>
 </html>

这是我的索引。html:

 <!DOCTYPE html>
 <html>
   <head>
     <base href="/"></base>
     <title>Angular</title>

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">

     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>

     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>

     <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script>    

     <script>
         System.config({
             transpiler: 'typescript',
             defaultJSExtensions: true
         });
     </script>

     <!--<script src="angular2.dev.js"></script>
     <script src="router.dev.js"></script>
     <script src="http.js"></script>
     <script src="firebase/firebase.js"></script>-->  

     <script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
     <script src="../node_modules/angular2/bundles/router.dev.js"></script>
     <script src="../node_modules/angular2/bundles/http.js"></script>
     <script src="/src/firebase/firebaseNew.js"></script>  

   </head>

   <body class="container">
     <app></app>
     <script>
       /*System.import('app/app');*/
       System.import('src/app/app');
     </script>
   </body>
 </html>
我发现了这个问题

我没有将实时服务器指向正确的位置。 基本上,我太深了,所以它无法引用节点模式

还必须对我的index.html进行此更改:

 <!DOCTYPE html>
 <html>
   <head>
     <base href="/"></base>
     <title>Angular</title>

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">

     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>

     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>

     <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script>    

     <script>
         System.config({
             transpiler: 'typescript',
             defaultJSExtensions: true
         });
     </script>

     <!--<script src="angular2.dev.js"></script>
     <script src="router.dev.js"></script>
     <script src="http.js"></script>
     <script src="firebase/firebase.js"></script>-->  

     <script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
     <script src="../node_modules/angular2/bundles/router.dev.js"></script>
     <script src="../node_modules/angular2/bundles/http.js"></script>
     <script src="/src/firebase/firebaseNew.js"></script>  

   </head>

   <body class="container">
     <app></app>
     <script>
       /*System.import('app/app');*/
       System.import('src/app/app');
     </script>
   </body>
 </html>

有棱角的
System.config({
transpiler:'typescript',
defaultJSExtensions:true
});
/*系统导入(“应用程序/应用程序”)*/
系统导入('src/app/app');
我已经注释掉了index.html中的内容


现在,我使用git-bash:live-server--entry file=src/index.html检查对.js文件的请求是否实际返回了js文件。它可能返回404错误。。或者出于某种原因使用其他html。尝试转到*.js url并查看返回的内容Hi sirrocco我检查了js文件,它们中都有html索引标记,而不是js。Angular2.dev.js中有html索引。我可以与您共享任何文件来帮助您解决此问题吗?