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

后端 未结 8 1933
慢半拍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:53

    I can give you an inelegant solution, which is working for me. I just exported my path in my .bashrc file.

    export PATH="$PATH:./node_modules/.bin"
    

    Edit: It's been a while, but I have changed my strategy to use npm scripts instead. In the above case, setup package.json as follows:

    "scripts": {
        "sails": "sails"
    }
    

    Which you can then run with

    npm run sails
    

    or with arguments

    npm run sails -- 
    

提交回复
热议问题