npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

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:

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