1

While trying to install karma in ubuntu using command

sudo npm install -g karma

i'm getting errors like

npm ERR!     at Object.parse (native)
npm ERR!     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:238:23)
npm ERR!     at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/index.js:148:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/index.js:876:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/index.js:827:12)
npm ERR!     at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:910:16
npm ERR!     at process._tickCallback (node.js:415:13)

And a number of errors like

npm ERR! registry error parsing json

And it's not getting installed.Any help would be appreciated.My node.js version is v0.10.13

4

5 回答 5

5

我的 npn install karma 失败了,我解决了我的问题

sudo ln -s /usr/bin/nodejs /usr/bin/node

在 Ubuntu 13.10 上

于 2013-12-05T21:44:02.137 回答
2

我在没有 sudo 的情况下运行 Ubuntu 12.04 时遇到问题,删除 -g 选项解决了在本地安装它的问题

npm install karma
npm install
于 2014-01-06T19:06:18.173 回答
1

I had the same issue, fixed by downloading the source code for 0.10.15 version. ./configure && make && sudo make install then sudo npm install -g karma and it works!

于 2013-08-13T07:25:53.860 回答
1

我在将业力安装到 vagrant 内部的 ubuntu 中时遇到了类似的问题。就我而言,安装看起来不错,但没有按预期工作。

$ sudo npm install --global karma
$ karma
No command 'karma' found, did you mean:
 Command 'karm' from package 'ktimetracker' (main)
karma: command not found

但是,查看安装输出,我可以找到真正安装 karma 的位置:

/usr/lib/node_modules/karma/bin/karma

如果只想输入 karma 并运行,只需运行:

 $ sudo ln -s /usr/lib/node_modules/karma/bin/karma /usr/bin/karma & chmod +x /usr/bin/karma
于 2014-11-25T13:59:30.437 回答
0

如果有人需要安装 nvm(为了更改节点的版本),然后 Nicolas 的说明:

curl https://raw.github.com/creationix/nvm/master/install.sh | sh
source ~/.profile
nvm ls-remote
nvm install 0.10.15
which node
node --version
sudo npm install karma
node --version
./configure
make 
sudo make install
sudo npm install -g karma
于 2013-12-27T14:57:45.013 回答