3

I'm running npm 1.2.18 and node v0.10.15. npm completion is broken. If I try to tab complete with npm or if I run npm completion, it displays:

npm ERR! System Linux 3.11.0-14-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "completion" "--color" "false" "--loglevel" "error" "--" "npm" "comple"
npm ERR! cwd /home/ajcrites
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! path /usr/share/npm/lib/utils/completion.sh
npm ERR! code ENOENT
npm ERR! errno 34

Indeed, /usr/share/npm/lib/utils/completion.sh does not exist, and the current directory gets an npm-debug.log file with similar information.

A Google Search reveals a lot of complaints about this issue for varying versions of node/Debian/zsh. If I use bash, tab completion works, but npm completion yields the same error about the missing file. As far as I can tell, none of the threads that you can easiliy find from the search actually have a solution. They just seem to be bug reports.

Is there anything I can do to fix this error? Is there an example completion.sh I can use or something?

1 Answer 1

2

I found a solution by using: http://manpages.ubuntu.com/manpages/oneiric/man1/npm-completion.1.html

Specifically I took the following file: http://manpages.ubuntu.com/manpages.gz/oneiric/man1/npm-completion.1.gz

And extracted it to:

/usr/share/npm/lib/utils/completion.sh

After restarting the console, npm in would complete to npm install!

2
  • bash: /usr/share/npm/lib/utils/completion.sh: Permission denied
    – Tosho
    Sep 18, 2014 at 0:45
  • sudo chmod +x /usr/share/npm/lib/utils/completion.sh
    – test30
    Apr 7, 2016 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .