[Pkg-javascript-devel] Bug#672388: Bug#672388: Bug#672388: npm: completion in Zsh causes error message regarding missing /usr/share/npm/lib/utils/completion.sh

Jérémy Lal kapouer at melix.org
Fri May 11 10:38:35 UTC 2012


On 11/05/2012 12:26, Jonas Smedegaard wrote:
> On 12-05-11 at 11:47am, Michael Prokop wrote:
>> * Jonas Smedegaard [Thu May 10, 2012 at 09:31:22PM +0200]:
>>> On 12-05-10 at 06:27pm, Michael Prokop wrote:
>>
>>>> I'm using Zsh:
>>
>>>> % zsh --version
>>>> zsh 4.3.17 (x86_64-unknown-linux-gnu)
>>
>>>> which provides a completion in its package
>>>> (/usr/share/zsh/functions/Completion/Unix/_npm), but
>>>> there seems to be something fishy in the npm package.
>>
>>> What makes you decide that the fishy part is in npm when zsh 
>>> provided that /usr/share/zsh/functions/Completion/Unix/_npm file?
>>
>>> I could easily imagine that zsh had put something together that 
>>> assumed npm was installed outside of the system, i.e. below either 
>>> $home or /usr/local - which obviously isn't the case for 
>>> Debian-packaged npm.
>>
>>> Or did I misunderstand something?
>>
>> Well, Zsh's completion file is as simple as that:
>>
>> | % cat /usr/share/zsh/functions/Completion/Unix/_npm
>> | #compdef npm
>> |
>> | # Node Package Manager 0.3.15 completion, letting npm do all the completion work
>> |
>> | _npm() {
>> |   compadd -- $(_npm_complete $words)
>> | }
>> |
>> | # We want to show all errors of any substance, but never the "npm (not )ok" one.
>> | # (Also doesn't consider "ERR! no match found" worth breaking the terminal for.)
>> | _npm_complete() {
>> |   local ask_npm
>> |   ask_npm=(npm completion --color false --loglevel error -- $@)
>> |   { _call_program npm $ask_npm 2>&1 >&3 \
>> |   | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \
>> |   } 3>&1
>> | }
>> |
>> | _npm "$@"
>>
>> And running the "npm completion" command even without any further
>> arguments fails (in Zsh and Bash):
>>
>> | % npm completion
>> |
>> | npm ERR! Error: ENOENT, open '/usr/share/npm/lib/utils/completion.sh'
>> | npm ERR! You may report this log at:
>> | npm ERR!     <http://bugs.debian.org/npm>
>> | npm ERR! or use
>> | npm ERR!     reportbug --attach /home/mika/npm-debug.log npm
>> | npm ERR!
>> | npm ERR! System Linux 3.2.0-1-grml-amd64
>> | npm ERR! command "node" "/usr/bin/npm" "completion"
>> | npm ERR! cwd /home/mika
>> | npm ERR! node -v v0.6.17
>> | npm ERR! npm -v 1.1.4
>> | npm ERR! path /usr/share/npm/lib/utils/completion.sh
>> | npm ERR! code ENOENT
>> | npm ERR! message ENOENT, open '/usr/share/npm/lib/utils/completion.sh'
>> | npm ERR! errno {}
>> | npm ERR!
>> | npm ERR! Additional logging details can be found in:
>> | npm ERR!     /home/mika/npm-debug.log
>> | npm not ok
>>
>> So from my POV the completion command of npm is broken in the Debian
>> package.
> 
> Agreed.  Thanks for the valuable details!

This shows that zsh is bundling an old npm completion script (0.3.x),
and this should be reported to zsh package.

It also shows that "npm completion" is broken (because of the missing
helper). npm package must fix that, but it may not fix zsh completion.

Jérémy.







More information about the Pkg-javascript-devel mailing list