Requirejs:dist failed, Loader plugin did not call the load callback in the build: text

1.4k views Asked by At

I'm using yeoman and grunt build fails at requirejs:dist with the error "Loader plugin did not call the load callback in the build: text".

I've seen the question here but updating requirejs didn't help me. Console output below:

    PS D:\...> bower -version
    1.2.7
    PS D:\...> npm -version
    1.3.11
    PS D:\...> bower ls
    bower check-new     Checking for new versions of the project dependencies..
    html-console#0.0.0 D:\...
    +-- backbone#1.1.0
    +-- bootstrap#3.0.1
    ¦ +-- jquery#2.0.3
    +-- jquery#2.0.3
    +-- modernizr#2.6.2
    +-- requirejs#2.1.9
    +-- requirejs-text#2.0.10
    +-- sass-bootstrap#3.0.1
    ¦ +-- jquery#2.0.3
    +-- underscore#1.5.2
    PS D:\...> npm ls | grep require
    ????????? [email protected]
    ??? ????????? [email protected]
    ????????? [email protected]
    ??? ????????? [email protected]
    PS D:\...> grunt build
    Running "clean:dist" (clean) task
    Cleaning .tmp...OK

    Running "coffee:dist" (coffee) task

    Running "coffee:test" (coffee) task

    Running "createDefaultTemplate" task

    Running "jst:compile" (jst) task
    >> Destination not written because compiled files were empty.

    Running "compass:dist" (compass) task
    directory .tmp/styles/
       create .tmp/styles/login-reg.css (0.029s)
       create .tmp/styles/main.css (1.796s)
    Compilation took 1.83s

    Running "useminPrepare:html" (useminPrepare) task
    Going through app/index.html to update the config
    Looking for build script HTML comment blocks

    Found a block:
            <!-- build:css(.tmp) styles/main.css -->
            <link rel="stylesheet" href="styles/main.css">
            <link rel="stylesheet" href="styles/login-reg.css">
            <!-- endbuild -->
    Updating config with the following assets:
        - .tmp\styles\main.css
        - .tmp\styles\login-reg.css

    Found a block:
            <!-- build:js scripts/vendor/modernizr.js -->
            <script src="bower_components/modernizr/modernizr.js"></script>
            <!-- endbuild -->
    Updating config with the following assets:
        - app\bower_components\modernizr\modernizr.js

    Found a block:
            <!-- build:js scripts/main.js -->
            <script data-main="scripts/main" src="bower_components/requirejs/require.js"></script>
            <!-- endbuild -->
    Updating config with the following assets:
        - dist\scripts\main.js

    Configuration is now:

      cssmin:
      { dist:
       { files:
          { '<%= yeoman.dist %>/styles/main.css':
             [ '.tmp/styles/{,*/}*.css',
               'app/styles/{,*/}*.css' ] } },
      'dist\\styles\\main.css': 'dist\\styles\\main.css' }

      concat:
      { 'dist\\styles\\main.css':
       [ '.tmp\\styles\\main.css',
         '.tmp\\styles\\login-reg.css' ],
      'dist\\scripts\\vendor\\modernizr.js': [ 'app\\bower_components\\modernizr\\modernizr.js' ],
      'dist\\scripts\\main.js': [ 'dist\\scripts\\main.js' ] }

      uglify:
      { 'dist\\scripts\\vendor\\modernizr.js': 'dist\\scripts\\vendor\\modernizr.js',
      'dist\\scripts\\main.js': 'dist\\scripts\\main.js',
      'dist\\bower_components\\requirejs\\require.js': 'app\\bower_components\\requirejs\\require.js' }

      requirejs:
      { dist:
       { options:
          { baseUrl: 'app/scripts',
            optimize: 'none',
            paths: { templates: '../../.tmp/scripts/templates' },
            preserveLicenseComments: false,
            useStrict: true,
            wrap: true,
            name: 'main',
            out: 'dist\\scripts\\main.js',
            mainConfigFile: 'app\\scripts\\main.js' } } }

    Running "requirejs:dist" (requirejs) task
    >> Error: Error: Loader plugin did not call the load callback in the build: text
    >> Module loading did not complete for: main, app, router, views/users/register, text!/templates/unauthd/register.html,
    views/users/forgotpassword, text!/templates/unauthd/forgotpassword.html
    >> The following modules share the same URL. This could be a misconfiguration if that URL only has one anonymous module
    in it:
    >> undefined: text!/templates/unauthd/register.html, text!/templates/unauthd/forgotpassword.html
    >>     at Function.build.checkForErrors (D:\...\node_modules\grunt-requirejs\node_modules\requirejs\bin\r.js:25510:19)
    Warning: Task "requirejs:dist" failed. Use --force to continue.

    Aborted due to warnings.

    Elapsed time
    loading tasks       2s
    jst:compile         24ms
    compass:dist        2s
    useminPrepare:html  63ms
    requirejs:dist      528ms
    Total               5s
    PS D:\...>
1

There are 1 answers

0
user2364618 On

Version 2.1.10 of r.js improved the error reporting. You will probably find, like I did, that your supplemental HTML files (register.html and forgotpassword.html) aren't being copied to .tmp like you want them to be. I'm working on the configuration issues for that right now, but it's probably easier to just have a backbone view load an ejs that has no substitutions.