mardi 31 décembre 2013

Installing globally Karma test runner on Debian

I was not able to install Karma test runner for JavaScript on my Debian squeeze. It kept failing with the error message:

npm ERR! System Linux 3.11-2-amd64
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "-g" "install" "karma"
npm ERR! cwd /home/ma
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.10
npm ERR! path /usr/local/lib/node_modules/karma/node_modules/lodash/dist/lodash.compat.js
npm ERR! fstream_path /usr/local/lib/node_modules/karma/node_modules/lodash/dist/lodash.compat.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

By default, Debian installs node.js with the name nodejs although the usual name for the node command is node. For some reason, this causes an issue with the npm install of karma. I then created a symbolic link node which points to nodejs:

sudo ln -s /usr/bin/nodejs /usr/bin/node
This solved the issue and I was able to install karma without any problem with the command:
sudo npm -g install karma

Aucun commentaire:

Enregistrer un commentaire