Npm command doesn't support quoted arguments

I saw that there was a wrapper around npm

$ type npm
npm is hashed (/opt/nvm/versions/node/v10/bin/npm)

$ cat /opt/nvm/versions/node/v10/bin/npm
#!/usr/bin/env bash
set -e

err() { echo "$@" 1>&2; }

args=$@
while [[ "$1" =~ ^- ]]; do
  shift
done

npm-real $args

what’s this from? it looks all weird. there’s an unused err function. it looks through the positional parameters but backs it up in $args and then never does anything with the filtered $@. and then it calls the real npm with kind-of-the-original args, but with quoting broken

e.g. to un-deprecate a package, you’re supposed to do this

npm deprecate examplepackage ''

but you can’t do it through this wrapper

Hi, so my apologies as this response is a long time coming - basically we acknowledge that this is a bug but we don’t expect to be able to prioritize it in the near future.

3 Likes

I see that the above reply is actually a coded message meaning “we’ve removed the wrapper and thus quoted arguments will now work as expected.”

$ head /opt/nvm/versions/node/v10/bin/npm
#!/usr/bin/env node
;(function () { // wrapper in case we're in module_context mode
  // windows: running "npm blah" in this folder will invoke WSH, not node.
  /* global WScript */
  if (typeof WScript !== 'undefined') {

thanks glitch, y’all are so quirky and fun

Hey, I was just passing on the information I was given. I’ll make sure that this is an intended change so that we don’t get blindsided if it gets reverted, though!

3 Likes

Okay, I’m back and I was just told that this ended up being fixed as part of another fix for another bug, so consider the wrapper officially removed! Sorry for the confusion, there!

2 Likes

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