Issue integrating npm completions with direnv, nodenv

Hi, I am trying to follow the documented steps for setting up tab completion for npm commands. For example, I want:

  • npm s => npm start
  • npm r => npm run-script
  • npm run-script s => npm run-script start-fresh (I have a start-fresh task registered in my package.json scripts key)

I am executing . <(npm completion) in my bash shell session. However, none of these completions occur, only filenames are completing.

For what itโ€™s worth, I am using Node.js 10, nodenv, direnv, Homebrew, macOS 10.12.

I am able to tab complete other application such as make and Maven on top of nodenv and direnv, just not NPM.

The incantation for setting up completion without using a file is bit tricky on Mac. However, writing to file works fine. e.g.

npm completion > ~/.npm.completion
source ~/.npm-completion

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.