简体   繁体   中英

npm doesn't install global modules correct

There's a problem with installing my global modules properly.

My System

  • OS : OS X Mountain Lion
  • node.js : 0.10.18 (Package installer)

Steps to reproduce

Input

npm install coffee -g (or any other module)

Output

npm http GET https://registry.npmjs.org/coffee
npm http 200 https://registry.npmjs.org/coffee
{lots of dependencies}
coffee@0.0.1 /usr/local/lib/node_modules/coffee
├── node-getopt@0.2.3
├── modular-amd@0.1.2
├── chai@1.7.2 (assertion-error@1.0.0)
├── mocha@1.11.0 (growl@1.7.0, debug@0.7.2, commander@0.6.1, diff@1.0.2, mkdirp@0.3.5, ms@0.3.0, jade@0.26.3, glob@3.2.1)
├── express@3.2.6 (methods@0.0.1, fresh@0.1.0, range-parser@0.0.4, cookie-signature@1.0.1, buffer-crc32@0.2.1, cookie@0.1.0, debug@0.7.2, commander@0.6.1, mkdirp@0.3.4, send@0.1.0, connect@2.7.11)
├── sinon@1.7.3 (buster-format@0.5.6)
└── sinon-chai@2.4.0

Input

coffee

Output

-bash: coffee: command not found

Other information

  • npm config get prefix : /usr/local
  • Read/Write access für /usr/local : Yes
  • $PATH : /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
  • /usr/local/share/npm exists : No
  • /usr/local/lib/node_modules/coffee exists : Yes
  • /usr/local/bin/coffee exists : No

What else can I do?

I won't add the direct link to coffee to my $PATH -variable, because that's not my job, that's the job of npm ! Really, why should I use npm when I could do it by myself? I read that answer like 100 times and I have no words for this, which aren't against the rules on SO.

If you want to install CoffeeScript globally (as one of the tags suggests), you shall install coffee-script (not coffee ). Additionally, sudo is required for installing global module on the Mac.

Command:

sudo npm install coffee-script -g

Input

% coffee

Output

coffee>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM