I was started to read "Developing an AngularJS Edge", and I wanted to set up the various frameworks in use.
The book uses nodejs and karma, along with several other frameworks.
I'm on Win7x32.
I just upgraded my nodejs to the latest, v0.10.18 .
I installed the Karma package with "npm install -g karma". This appeared to plete successfully.
I then ran "karma init", which did this:
% karma init
>
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\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:167:9)
at nextQuestion (C:\Users\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:235:12)
at process (C:\Users\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:250:10)
at Object.exports.init (C:\Users\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:352:6)
at Object.<anonymous> (C:\Users\David\AppData\Roaming\npm\node_modules\karma\bin\karma:25:37)
at Module._pile (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)
Note that this error is virtually identical to the stack trace reported by this person a month ago, but that report has received no response.
I was started to read "Developing an AngularJS Edge", and I wanted to set up the various frameworks in use.
The book uses nodejs and karma, along with several other frameworks.
I'm on Win7x32.
I just upgraded my nodejs to the latest, v0.10.18 .
I installed the Karma package with "npm install -g karma". This appeared to plete successfully.
I then ran "karma init", which did this:
% karma init
>
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\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:167:9)
at nextQuestion (C:\Users\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:235:12)
at process (C:\Users\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:250:10)
at Object.exports.init (C:\Users\David\AppData\Roaming\npm\node_modules\karma\lib\init.js:352:6)
at Object.<anonymous> (C:\Users\David\AppData\Roaming\npm\node_modules\karma\bin\karma:25:37)
at Module._pile (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)
Note that this error is virtually identical to the stack trace reported by this person a month ago, but that report has received no response.
Share Improve this question edited May 23, 2017 at 12:02 CommunityBot 11 silver badge asked Sep 28, 2013 at 19:19 David M. KarrDavid M. Karr 15.2k22 gold badges111 silver badges221 bronze badges 3- Cannot reproduce with node 0.10.18, karma 0.10.2 on Windows 7 Ultimate (both 32 and 64 bit) – SheetJS Commented Sep 28, 2013 at 19:40
- Are there any additional diagnostics I can produce that might provide more meaningful information? – David M. Karr Commented Sep 28, 2013 at 20:30
- Did you install using the package from nodejs? – SheetJS Commented Sep 28, 2013 at 22:27
8 Answers
Reset to default 7Probably you're using the Git Bash terminal, MinTTY, which doesn't have full support for TTY.
You have 4 options to fix the problem:
- Use CMD terminal with the Windows shell (the default Windows console)
- Use CMD terminal with the Bash shell (execute
"C:\Program Files\Git\bin\bash.exe" --login -i
in cmd terminal) - Use Powershell (an alternative terminal typically installed by default in Windows environments)
- Use an alternative terminal (or develop a new one :stuck_out_tongue_winking_eye: )
If you just need execute isolated interactive mands like karma init
, I remend option 1 for it and then e back to Git Bash. However I would give a try to Powershell.
Faced the same issue.try this
node node_modules/karma/bin/karma init
The reason for the error with running npm in Cygwin seems to be a known issue with npm. You can use the work around mentioned here,
https://stackoverflow./a/22436199/2390020
I got the same error with MINGW64.
Runs properly on default mand prompt.
One other likely relevant point that I failed to mention is that I was running these mands from a Cygwin rxvt window.
I just tried pletely uninstalling nodejs and reinstalling it.
When I brought up the rxvt window again and ran "npm install -g karma", it failed with the following:
/c/Program Files/nodejs/npm: line 2: $'\r': mand not found
/c/Program Files/nodejs/npm: line 4: $'\r': mand 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
That led me to search for that error on the web, and I found this thread, which implies that it simply doesn't support Cygwin (unfortunate, but not a huge problem).
When I then brought up a plain, ugly, unfriendly "cmd" window, both the karma installation and "karma init" pleted successfully (or at least it gave me the first question in the "init" process).
In my case, the problem was that I was using the git bash terminal in windows. When I ran the mand in a cmd window it worked fine.
Run the mand in github shell mand window. Worked for me.
If you open up the karma
file it's just a node script, so an alternative way of executing it would be:
node karma init
This worked for me in the MINGW64/git bash shell