1
$ karma init configs/karma.conf.js
>
readline.js:507
  this.line = this.line.slice(this.cursor);
                    ^
TypeError: Cannot call method 'slice' of undefined
    at Interface._deleteLineLeft (readline.js:507:25)
    at suggestNextOption         (C:\Users\DEVUSER\AppData\Roaming\npm\node_modules\karma\lib\init.js:165:9)
at nextQuestion (C:\Users\DEVUSER\AppData\Roaming\npm\node_modules\karma\lib\init.js:231:12)
at process (C:\Users\DEVUSER\AppData\Roaming\npm\node_modules\karma\lib\init.js:246:10)
at Object.exports.init (C:\Users\DEVUSER\AppData\Roaming\npm\node_modules\karma\lib\init.js:348:6)
at Object.<anonymous> (C:\Users\DEVUSER\AppData\Roaming\npm\node_modules\karma\bin\karma:26:37)
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)

I am getting this error when trying to run karma init configs/karma.conf.js

I have all of this running under Windows 7 x64

I am following this guide: https://coderwall.com/p/xz-qcg

Any suggestions would be appreciated.

Marty Lavender
  • 373
  • 1
  • 3
  • 8
  • I don't have a solution, but I've gotten almost exactly the same error. I had nodejs installed, I installed the karma package, and ran "karma init". The only differences are that it was on line 494 of readline.js, and it said "StateMachine.suggestNextOption" instead of "suggestNextOption". I'm on Win7x32. – David M. Karr Sep 28 '13 at 18:52
  • Just so it's clear, once I upgraded node to the latest (0.10.18), my "karma init" now produces a stack trace that is even closer to what you reported, so that didn't help. – David M. Karr Sep 28 '13 at 19:14

1 Answers1

1

I had the same problem, but I was running this in Cygwin. I don't know if you were.

I first uninstalled and reinstalled nodejs.

When I brought up the rxvt window again to try installing karma, it failed with this:

/c/Program Files/nodejs/npm: line 2: $'\r': command not found
/c/Program Files/nodejs/npm: line 4: $'\r': command not found
/c/Program Files/nodejs/npm: line 5: syntax error near unexpected token `$'in\r''
'c/Program Files/nodejs/npm: line 5: `case `uname` in

This is apparently because of my using it in Cygwin, although I don't know why I didn't get this error before. The following talks about this: https://github.com/isaacs/npm/issues/3710 .

So, I then just opened up a plain "cmd" window, and I found that the package install completed, and "karma init" worked well enough to ask me the first "init" question, so I imagine this is resolved.

Community
  • 1
  • 1
David M. Karr
  • 14,317
  • 20
  • 94
  • 199