已安装业力时找不到业力命令 [英] karma command not found when karma already installed

查看:54
本文介绍了已安装业力时找不到业力命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用node.js来安装业力.在终端上运行以下命令时,我的第一次尝试失败:

I used node.js to install karma. My first try failed when running the following command on Terminal:

npm install -g karma

那失败了,所以我决定使用:

That failed so I decided to use:

sudo npm install -g karma

输入密码后,它似乎可以正确安装. 我正在粘贴安装输出的一部分,也许对某人有意义,并且与我的问题有关.在所有npm http消息之后,这就是我所看到的:

After entering my password it seemed to install correctly. I am pasting part of the output of the install, maybe it will mean something to someone and it will be relevant to my question. After all the npm http messages this is what I see:

> ws@0.4.27 install /usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished
/usr/local/share/npm/bin/karma -> /usr/local/share/npm/lib/node_modules/karma/bin/karma
karma@0.8.6 /usr/local/share/npm/lib/node_modules/karma
├── pause@0.0.1
├── dateformat@1.0.2-1.2.3
├── xmlbuilder@0.4.2
├── colors@0.6.0-1
├── chokidar@0.6.2
├── growly@1.1.1
├── mime@1.2.9
├── q@0.9.6
├── rimraf@2.1.4 (graceful-fs@1.2.3)
├── coffee-script@1.6.3
├── minimatch@0.2.12 (sigmund@1.0.0, lru-cache@2.3.0)
├── optimist@0.3.5 (wordwrap@0.0.2)
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
├── LiveScript@1.0.1 (prelude-ls@1.0.1)
├── log4js@0.6.6 (dequeue@1.0.3, semver@1.1.4, async@0.1.15, readable-stream@1.0.2)
├── lodash@1.1.1
├── http-proxy@0.10.3 (pkginfo@0.2.3, utile@0.1.7)
├── istanbul@0.1.22 (abbrev@1.0.4, which@1.0.5, fileset@0.1.5, nopt@2.0.0, wordwrap@0.0.2, async@0.1.22, mkdirp@0.3.5, esprima@0.9.9, escodegen@0.0.24, handlebars@1.0.12)
└── socket.io@0.9.16 (base64id@0.1.0, policyfile@0.0.4, redis@0.7.3, socket.io-client@0.9.16)

然后,当我尝试运行以下命令以使用此命令创建业力配置文件时:

Then when I try to run the following command to create a karma config file with this command:

karma init karma.config.js

这是返回的消息:

-bash: karma: command not found

我在sudo之前尝试过相同的命令,但得到的结果相同.

I have tried the same command with sudo before it but I get the same result.

有人对发生的事情有任何想法吗? 感谢您的帮助.

Does anyone have any idea as to what is going on? Any help is appreciated.

*更新! 我决定检查一个名为:builderror.log的文件 位于:/usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws

*Update! I decided to check a file named: builderror.log located in: /usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws

这是显示的内容:

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/eperez/.node-gyp/0.10.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.node-gyp"
gyp http GET http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz

推荐答案

@mayankcpdixit 给出了答案回答了OP的原始问题,但是如果有人错过了,我会再把它放在这里.

@mayankcpdixit gave the answer up there in a response to the OP's original question, but I'll put it here again in case anyone misses it.

您不需要卸载所有内容,如果我必须为每个要安装的npm软件包手动添加一个新的路径链接,我可能会自杀.

You do not need to uninstall everything, and if I had to manually add a new path link for every npm package I try to install I'd probably shoot myself.

npm install -g karma-cli

景气.现在,您已经安装了业力命令行.就像咕unt.

Boom. Now you have karma command lines installed. Just like Grunt.

请不要忘记投票 @mayankcpdixit ,他也直接对原始帖子发表了评论,但是并没有真正回答"问题.

Please don't forget to upvote @mayankcpdixit as well, he commented directly on the original post, but didn't actually "answer" the question.

这篇关于已安装业力时找不到业力命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆