最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError: modules[moduleId] is undefined - Stack Overflow

programmeradmin2浏览0评论

I am trying to run jasmine unit testing with Jenkins using Firefox browser on Linux and I keep having this behavior:

[32m02 08 2017 08:16:26.443:INFO [Firefox 50.0.0 (Windows 8.1 0.0.0)]:  [39mConnected on socket /#KYlvgi9JYtXnD1jZAAAB with id manual-931
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
  TypeError: modules[moduleId] is undefined
  at :9876/_karma_webpack_/inline.bundle.js:55
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
  TypeError: modules[moduleId] is undefined
  at :9876/_karma_webpack_/inline.bundle.js:55


[33m02 08 2017 08:21:27.750:WARN [Firefox 50.0.0 (Windows 8.1 0.0.0)]:  [39mDisconnected (1 times)
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
Disconnectedundefined
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
Disconnectedundefined

The exception is on this Line of code:

// Execute the module function
/******/        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

I research a lot about the issue, but I couldn't find any solution. Is there anyone that can help me to solve it.

I am trying to run jasmine unit testing with Jenkins using Firefox browser on Linux and I keep having this behavior:

[32m02 08 2017 08:16:26.443:INFO [Firefox 50.0.0 (Windows 8.1 0.0.0)]:  [39mConnected on socket /#KYlvgi9JYtXnD1jZAAAB with id manual-931
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
  TypeError: modules[moduleId] is undefined
  at http://52.5.4.155:9876/_karma_webpack_/inline.bundle.js:55
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
  TypeError: modules[moduleId] is undefined
  at http://52.5.4.155:9876/_karma_webpack_/inline.bundle.js:55


[33m02 08 2017 08:21:27.750:WARN [Firefox 50.0.0 (Windows 8.1 0.0.0)]:  [39mDisconnected (1 times)
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
Disconnectedundefined
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
Disconnectedundefined

The exception is on this Line of code:

// Execute the module function
/******/        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

I research a lot about the issue, but I couldn't find any solution. Is there anyone that can help me to solve it.

Share Improve this question edited Feb 2, 2018 at 10:52 Cecilya 5271 gold badge6 silver badges23 bronze badges asked Aug 2, 2017 at 17:12 Dim SleimanDim Sleiman 511 gold badge1 silver badge4 bronze badges 2
  • found any solution? I have the same problem – Ivan Vilanculo Commented Oct 25, 2017 at 5:58
  • It could be the reason of some missing ma or brackets. Common places are route array, styles array, etc – Manu Mohan Commented Sep 2, 2018 at 11:11
Add a ment  | 

1 Answer 1

Reset to default 1

I faced same issue and found that in Karma.conf.js, I was using wrong configuration for "files" as

module.exports = function (config) {
config.set({
    basePath: '.',
    frameworks: ['jasmine'],
    files: [
        '../../ClientApp/dist/vendor.js',
        './boot-tests.ts'
    ],

Modified this to target only files which contain unit tests as

module.exports = function (config) {
config.set({
    basePath: '.',
    frameworks: ['jasmine'],
    files: [
        '../../ClientApp/**/*.spec.ts'
    ],

and now I don't get this error. Though something else going wrong in my tests so getting other errors but seems this specific issue resolved.

发布评论

评论列表(0)

  1. 暂无评论