0

I am trying to setup the angular2 app with my local system. without using any feeds. but i am getting error as Uncaught ReferenceError: System is not defined - but systemjs folder is there, is there in my moulde folder.

what is wrong with my set-up here?

here is my html file :

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>A2-App</title>
    <link rel="stylesheet" href="styles/global.css">
</head>
<body>
    <hello-app>Loading...</hello-app>
</body>
<!-- ES6-related imports -->
<script src="js/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="js/node_modules/es6-shim/es6-shim.js"></script>
<script src="js/node_modules/systemjs/dist/system.js"></script>//file exist there, but getting 404
<script>
    //configure system loader
    System.config({defaultJSExtensions: true});
</script>
<script src="js/node_modules/rxjs/bundles/Rx.js"></script>
<script src="js/node_modules/angular2/bundles/angular2.min.js"></script>
<script>
    //bootstrap the Angular2 application
    System.import('dist/app').catch(console.log.bind(console));
</script>
</html>
7
  • Could you move all your scripts in the head and move System.config / System.import after Importing js files? Commented Mar 12, 2016 at 7:25
  • done, still no luck. I am using sublime it is giving autofil to all lib files other than systemjs - this is for your additional info Commented Mar 12, 2016 at 7:29
  • On which line does the error occurs? Within your HTML file? Commented Mar 12, 2016 at 7:54
  • @ThierryTemplier - line number 19 System.config({defaultJSExtensions: true}); Commented Mar 12, 2016 at 8:02
  • Thanks! Could you make a try with SystemJS provided by code.angularjs.org/tools? Your configuration should work... Commented Mar 12, 2016 at 8:49

1 Answer 1

3

I think that the problem comes from the version of SystemJS you use. Here are the versions:

  • angular2 beta9
  • systemjs 0.19.24

And include it this way:

<script src="node_modules/systemjs/dist/system.src.js"></script>

See this page for more details:

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.