Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install -g karma does not install executable

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:

> [email protected] 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
[email protected] /usr/local/lib/node_modules/karma
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

like image 560
Dmitri Zaitsev Avatar asked Dec 27 '13 04:12

Dmitri Zaitsev


2 Answers

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.

like image 122
spawnedc Avatar answered Oct 28 '22 03:10

spawnedc


It seems that npm places all installed binaries in the folder <npm-global-prefix>/bin, so to make these binaries available in the shell you can add the following line to your shell startup script (e.g. ~/.profile, ~/.bash_profile, ~/.bash_aliases):

export PATH=`npm prefix -g`/bin:$PATH
like image 20
gTcV Avatar answered Oct 28 '22 05:10

gTcV