1

I am a new developer with backbone and require.js.

This is the structure of my project :

enter image description here

And this my code :

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="app/script/libs/require.js" data-main="app/script/main.js" type="text/javascript"></script>
</head>
<body>

</body>
</html>

This is main.js :

require.config({
   paths: {
     jquery: 'app/script/libs/jquery/jquery-1.7.1',
     underscore: 'app/script/libs/underscore/underscore',
     backbone: 'app/script/libs/backbone/backbone'
   },
   shim: {
     backbone: ['jquery', 'underscore']
   }
 });

 require(['app'], function(App){
     App.initialize();
 });

And then when I browse in the browser, I got this error in the console of firefox :

Error: Script error http://requirejs.org/docs/errors.html#scripterror
[Break On This Error]   

...irejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=i;d&&(c.origina...

Anyone can tell me, how this error come please? Thanks.

2
  • Try to use the development version of require (not minified). And can you post the content of your main.js file? Commented Jul 10, 2013 at 11:40
  • @Tallmaris : I post it ready dear. Commented Jul 11, 2013 at 0:45

1 Answer 1

1

Your require.config contains folders which dont exist. There are no folders such as backbone, jquery, underscore under the app/libs

Change your require.config to the following

require.config({
   paths: {
     jquery: 'app/script/libs/jquery-1.7.1',
     underscore: 'app/script/libs/underscore',
     backbone: 'app/script/libs/backbone'
   },
   shim: {
     backbone: ['jquery', 'underscore']
   }
 });

 require(['app'], function(App){
     App.initialize();
 });
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.