簡體   English   中英

串聯涼亭組件上的Angularjs(錯誤:$ injector:modulerr模塊錯誤)?

[英]Angularjs (Error: $injector:modulerr Module Error) on concatenating bower components?

當我使用grunt串聯angularjs(angular&ui-router)的bower_components時,

我收到一個(Error: $injector:modulerr Module Error)此處完整錯誤https://goo.gl/0yz6pm

在生成的腳本上。

當我直接從bower_components使用腳本源時,我沒有收到此錯誤

因此,我認為這是一個咕gr串聯的問題。

下面是咕unt的腳本,

grunt.initConfig({

    concat:{

        options: {
        },
        dist: {
          // the files to concatenate
          src: ['client/bower_components/angular/angular.min.js','client/bower_components/angular-ui-router/release/angular-ui-router.min.js'],
          // the location of the resulting JS file
          dest: 'client/bower_components/../assets/scripts/coreScript.js',
          nonull: true
        }

    }


  })


  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.registerTask('build',['concat']);

}

我也嘗試過使用seperator:';' options但沒有幫助。

我該怎么做才能在此處進行串聯?

假設所有這些腳本引用均正確並且您在頁面上引用coreScript.js,則此設置看起來不錯。 我在這里看到的唯一問題是您對.registerTask的調用。 觀察您的實施

grunt.registerTask('build','concat']);

但是,咕unt聲期待一個任務數組

grunt.registerTask('build', ['concat']); // close array with [

是否可能因為此問題而無法成功運行此任務? 我也沒有看到readJSON的電話。 您還可能在gruntfile.js聲明中缺少以下內容嗎?

grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    concat: {
        // ...
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM