0

I have this path in require.js

require.config({
    "paths": {
        "jquery": "../../../../../endeavour-ui-common/src/main/webapp/js/libs/jquery/jquery-1.8.2.min",
        ....   
    },
    "shim"{
         ....

It is giving me

Error: scripterror: Illegal path or script error: ['jquery']

I can make sure that path is correct because same path opens the file in terminal. For example:

open ../../../../../endeavour-ui-common/src/main/webapp/js/libs/jquery/jquery-1.8.2.min.js 

Any clue how to fix this?

1
  • 1
    The better question is can you convert that to a URL and request that URL from a browser - that's what RequireJS does. Commented Oct 28, 2013 at 15:21

2 Answers 2

2

This might be helpful Generate URLs relative to module:

as said by @codingGorilla you will have to convert that path to a URL

    define(["require"], function(require) {
    var cssUrl = require.toUrl("./style.css");
});
0

you have to be open the address from a web browser and not from the terminal.

That would mean that the path has to be relative to the webpage or to your domain root if you prefix it with /

(e.g.) if your web root is one directory up then you will do something like

    "jquery": "/endeavour-ui-common/src/main/webapp/js/libs/jquery/jquery-1.8.2.min",

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.