1

Environment issue with Angular2 typescript.

I can't get angular2 project to run. Typescript compiler has no errors.

There's only errors in the browser console.

Heres my error console:

enter image description here

Heres my index.html:

enter image description here

3
  • check that the requests for .js files are actually returning js files. It could be returning a 404 error .. or other bit of html for some reason. Try to go to the *.js url and see what's getting returned Commented Dec 7, 2015 at 15:44
  • Hi sirrocco I checked the js files and they all have the html index markup in them instead of js. Angular2.dev.js has html index in it Commented Dec 7, 2015 at 16:41
  • Are there any files I can share with you to help you solve this? Commented Dec 7, 2015 at 16:54

1 Answer 1

1

I found the issue.

I wasnt point my live-server to the correct location. Basically, I was too deep so it couldnt reference the node modes.

This change also had to be made to my 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>

I've commented out what used to be in the index.html.

I now point my live-server like this using git bash: live-server --entry-file=src/index.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.