Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'mtime' of undefined #1532

Open
ghost opened this issue Aug 3, 2015 · 14 comments
Open

TypeError: Cannot read property 'mtime' of undefined #1532

ghost opened this issue Aug 3, 2015 · 14 comments

Comments

@ghost
Copy link

ghost commented Aug 3, 2015

Hi, my users get this error on Mac OS X with Karma 0.13.2. It's this line: https://github.com/karma-runner/karma/blob/v0.13.2/lib/file-list.js#L174 where mg.statCache[path] is undefined. Here is the Karma config that is used https://gist.github.com/Sanjo/fde7bf14768d6baf16e6.

Maybe related to #1494.

/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/file-list.js:174
      var mtime = mg.statCache[path].mtime
                                    ^
TypeError: Cannot read property 'mtime' of undefined
  at /Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/file-list.js:174:37
  at Array.map (native)
  at Promise.all.cancellable.then.self.buckets (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/file-list.js:168:30)
  at Array.map (native)
  at [object Object].List._refresh (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/file-list.js:151:37)
  at [object Object].List.refresh (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/file-list.js:250:27)
  at [object Object].Server._start (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/server.js:168:12)
  at [object Object].invoke (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/node_modules/di/lib/injector.js:75:15)
  at [object Object].Server.start (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/server.js:92:18)
  at Object.exports.run (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/lib/cli.js:231:26)
  at Object.<anonymous> (/Users/Dimitri/.meteor/packages/sanjo_karma/.1.6.1.6961j1++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/karma/bin/karma:3:23)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:929:3
@fbengrid
Copy link

fbengrid commented Aug 3, 2015

I had the same issue but solved it by changing all the file groups patterns ending from
*.{a,b,c} to *.+(a|b|c)

@ghost
Copy link
Author

ghost commented Aug 3, 2015

Ok, thanks. 👍 I will do that.

@dignifiedquire
Copy link
Member

Interesting, that this happens on non windows systems as well, this is mainly due to an issue in node-glob. Will have to do more digging. Thanks for the report

@ghost
Copy link
Author

ghost commented Aug 4, 2015

One of my package users reported that changing the glob patterns from *.{a,b,c} to *.+(a|b|c) fixed the problem as @fbengrid pointed out.

@eckdanny
Copy link

eckdanny commented Aug 4, 2015

+1 for @fbengrid's workaround (i'm on a mac)

Error snippet:

/path/to/node_modules/karma/lib/file-list.js:174
      var mtime = mg.statCache[path].mtime
                                    ^
TypeError: Cannot read property 'mtime' of undefined
...

My Env:

$sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.4
BuildVersion:   14E46
$node_modules/.bin/karma --version
Karma version: 0.13.4
karma-jasmine: 0.3.6
karma-phantomjs-launcher: 0.2.0

@cblair
Copy link

cblair commented Aug 18, 2015

+1 I have this issue fairly regularly on Ubuntu 14.04, using PyCharm 4.5 and the latest Karma plugin. karma package version 0.12.37:

ERROR [karma]: [TypeError: Cannot read property 'mtime' of undefined]
TypeError: Cannot read property 'mtime' of undefined
  at /mnt/colbblailx.old/home/colbblai/src/sel2730S/nucleus/core/omni/SettingsClasses/list/node_modules/karma/lib/file_list.js:317:31
  at Object.oncomplete (fs.js:108:15)

Haven't found what causes it exactly, happens intermittently. I do get errors just before it, which may be related. But again are related to something the karma runner is doing with .ktp.ts files, not sure why they're failing:

INFO [watcher]: Removed file "/.../src/cert.ts.ktp.ts".
WARN [watcher]: { [Error: ENOENT, stat '/.../src/cert.ts.ktp.ts']
  errno: 34,
  code: 'ENOENT',
  path: '/.../src/cert.ts.ktp.ts' }
Error: ENOENT, stat '/.../src/cert.ts.ktp.ts'

@richbai90
Copy link

I'm having this same issue and I can't find where to change the glob patterns. I'm on OS X Yosemite.

node version 0.12.1
karma version 0.13.9

@shawmanz32na
Copy link

It may be of interest to note that on one of the projects I'm working on, we had a dev perform the workaround mentioned by @fbengrid , which subsequently resulted in a WARN [watcher]: Pattern "C:/Users/username/project/src/main/webapp/scripts/components/**/*.{js|html}" does not match any file. message and an entire suite of broken tests on my Windows box due to the angular injector not having the required files.

You might want to verify that the fix works cross-platform before patching in the suggested workaround.

I'm using:
Windows 10
Node 0.12.7
Karma 0.12.35

@donaldpipowitch
Copy link

Thank you @fbengrid.

@fbengrid
Copy link

@shawmanz32na I do work mainly with windows environment (for the dev phase at least) but not on windows 10.
Just to be sure looking at the pattern you wrote and the one I was referring to for the "glob" to work on karma 0.13.x, it must use parenthesis not accolades: so *.+(js|html) and not *.{js|html}
Using accolades will not work for recent version of karma (last I worked with was 0.13.9).

@donaldpipowitch you're welcome, but it's the authors of this library who deserve our thanks for this great tool. :)

@shawmanz32na
Copy link

@fbengrid We changed our glob pattern to *.+(js|html) and all is well. Thanks for the clarification. We missed the part about changing the accolades to parens the first time around.

@vladyn
Copy link

vladyn commented Feb 19, 2016

Which conf file you referring? Can you paste the example please ?

@fbengrid
Copy link

the configuration file referred to is the one presented on http://karma-runner.github.io/0.13/config/configuration-file.html
and the patterns is the one used for the File attribute.

@mikebellcoder
Copy link

Just ran into this yesterday and comment from earlier fixed it for me.
#1532 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants