2

I want to make a npm package and can be installed as global,but when i publish a package,it can't be used in global,what should i do ?

I clone grunt-cli from github,I just want to test whether it can be installed in global,but i failed. What should i do?

justnode
  • 23
  • 5
  • What does "can't be used in global" mean? Anything can be installed globally, but without seeing any code, it will be hard to give more specific help. – loganfsmyth May 02 '15 at 16:29
  • 1
    ```javascript "bin": { "packageName": "./bin/packageName" } ``` when i add this code to package.json,i solve my problem. Thank for our answer,good luck to you – justnode May 03 '15 at 07:37

1 Answers1

0

To install a package as a global package you need to run npm install -g packagename.

On Mac and Linux you need to run sudo npm install -g packagename.

Jeff Sloyer
  • 4,899
  • 1
  • 24
  • 48