NPM : how to source ./node_modules/.bin folder?

后端 未结 8 1895
慢半拍i
慢半拍i 2021-02-19 14:23

I have a problem on npm installation

I have created a project say project A

cd ~/projectA
npm install sails

but sails command is not fo

8条回答
  •  一生所求
    2021-02-19 14:29

    If you don't like to mess up with your PATH for running a npm script that isn't global -- e.g. you are the only one to use it --, I would personally recommend the use of an sh "alias".

    1. npm install (locally) your beloved package (json-diff here, for instance)

      cd ~ && npm install json-diff
      
    2. alias it (save it in your ~/.xxxxrc file):

      alias diffj "\`npm bin\`/json-diff !*"
      

    Then, for diffing 2 json's:

    diffj old.json new.json
    

提交回复
热议问题