我使用 node.js 来安装业力。在终端上运行以下命令时,我的第一次尝试失败:
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 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