Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

globally installed npm-packages not working [closed]

local npm-packages work as predicted, but it seems impossible for me to get globally-installed packages running. It doesn't even throw any error, it's just not doing anything ( express, coffee, etc.. )

This was not bothering me much until I wanted to use coffee-script.

things I allready checked ( I'm on Xubuntu 12.04 ):

  • npm lists it

  • its installed in /usr/local/bin

  • ( updated | uninstalled | reinstalled ) npm via ( npm | apt-get )

  • uninstalled nodejs and did fresh git-rebuild to /opt/bin/node

    => same thing..

anyone knows a solution?

like image 273
tibtob Avatar asked Apr 05 '13 20:04

tibtob


2 Answers

is NODE_PATH variable set on your environment

//show if set
echo $NODE_PATH

//set NODE_PATH
NODE_PATH="/usr/local/lib/node_modules"

The NODE_PATH should contain the location of directories where the modules are installed. It can have multiple directories (colon seperated).

like image 151
user568109 Avatar answered Oct 13 '22 11:10

user568109


turns out it tried to start with node instead of nodejs command. So in /usr/local/lib/node_modules/coffee-script/bin/coffee I changed #!/usr/bin/env node to #!/usr/bin/env nodejs and works fine now.

like image 25
tibtob Avatar answered Oct 13 '22 11:10

tibtob