npm install -g karma does not install executable

2019-04-28 16:52发布

I have what looks like successful karma installation, yet karma is not in /usr/local/bin/ and is not found by bash.

Any idea what is wrong and how to fix it?

Here are the end installation messages:

> ws@0.4.31 install /usr/local/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
karma@0.11.12 /usr/local/lib/node_modules/karma
├── di@0.0.1
├── graceful-fs@2.0.1
├── rimraf@2.2.5
├── colors@0.6.2
├── mime@1.2.11
├── q@0.9.7
├── coffee-script@1.6.3
├── lodash@2.4.1
├── glob@3.2.7 (inherits@2.0.1)
├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
├── optimist@0.6.0 (wordwrap@0.0.2, minimist@0.0.5)
├── source-map@0.1.31 (amdefine@0.1.0)
├── log4js@0.6.9 (semver@1.1.4, async@0.1.15, readable-stream@1.0.17)
├── useragent@2.0.7 (lru-cache@2.2.4)
├── http-proxy@0.10.3 (pkginfo@0.2.3, optimist@0.3.7, utile@0.1.7)
├── chokidar@0.8.1
├── connect@2.12.0 (uid2@0.0.3, methods@0.1.0, pause@0.0.1, cookie-signature@1.0.1, fresh@0.2.0, qs@0.6.6, debug@0.7.4, bytes@0.2.1, raw-body@1.1.2, buffer-crc32@0.2.1, batch@0.5.0, cookie@0.1.0, negotiator@0.3.0, send@0.1.4, multiparty@2.2.0)
└── socket.io@0.9.16 (base64id@0.1.0, policyfile@0.0.4, redis@0.7.3, socket.io-client@0.9.16)

1条回答
何必那么认真
2楼-- · 2019-04-28 17:19

You can link it by yourself. As in:

#Assuming that /usr/local/bin is in your PATH
cd /usr/local/bin
ln -s /usr/local/lib/node_modules/karma/bin/karma

Clearly, this is not an ideal solution. I think there's a problem in the package.json of karma which prevents npm to create a link to the executable. Might be related to this.

查看更多
登录 后发表回答