我用node.js安装了karma。第一次在终端运行以下命令时失败了:
npm install -g karma
那个失败了,所以我决定使用:
sudo npm install -g karma
在输入密码后,似乎安装成功了。我复制了安装输出的一部分,也许对某个人有意义,并且与我的问题相关。在所有 npm http 消息之后,这是我看到的内容:> 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)
然后,当我尝试运行以下命令来使用此命令创建karma配置文件时:
karma init karma.config.js
这是返回的消息:
-bash: karma: command not found
我之前尝试过在命令前使用sudo,但是结果还是一样。
有没有人知道出了什么问题? 非常感谢任何帮助。
*更新! 我决定检查一个名为builderror.log的文件, 位于:/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
which karma
确认。我曾经遇到过 npm 将安装内容安装到不在默认路径中的情况,我想是在 Arch 上。但我不记得它去了哪里,抱歉:( PS 您可以执行cd /; find|grep karma
命令来获取系统中所有带有 karma 的文件名或路径。 - Plato用法: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression] find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
- iChidonpm install -g karma-cli
- mayankcpdixit