npm access grant: team is required and must be of type string

cli
triaged

(Morgan Touverey Quilling) #1

What I Wanted to Do

I’d like to grant read-write access to the sweetalert2 team on my package @toverux/ngx-sweetalert2 (btw, my readme isn’t showing on the npm website). For that, I’ve used this command: npm access grant read-write sweetalert2 with the library’s directory as the cwd.

I’ve also tried with an explicit package name: npm access grant read-write sweetalert2 @toverux/ngx-sweetalert2

What Happened Instead

It seems to me that the CLI doesn’t parses my arguments correctly, unless I’m not understanding the usage doc:

morgan@anthracite /home/morgan/Documents/Projets/ngx-sweetalert2                                     master
⚡ npm access grant read-write sweetalert2
npm ERR! team is required and must be of type string
npm ERR! 
npm ERR! Usage:
npm ERR! npm access public [<package>]
npm ERR! npm access restricted [<package>]
npm ERR! npm access grant <read-only|read-write> <scope:team> [<package>]
npm ERR! npm access revoke <scope:team> [<package>]
npm ERR! npm access ls-packages [<user>|<scope>|<scope:team>]
npm ERR! npm access ls-collaborators [<package> [<user>]]
npm ERR! npm access edit [<package>]

Platform Info

morgan@anthracite /home/morgan/Documents/Projets/ngx-sweetalert2                                     master
⚡ npm --versions
{ 'ngx-sweetalert2-repository': '0.0.0-unreleased-demo-project',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.12.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.35',
  zlib: '1.2.11' }

morgan@anthracite /home/morgan/Documents/Projets/ngx-sweetalert2                                     master
⚡ node -p process.platform
linux

Thanks for your time and help!


(Lars Willighagen) #2

You need to add which org/user scope you want to change the team for, as you can have multiple. So the correct command would be (in the package dir):

npm access grant read-write toverux:sweetalert2

Or, from anywhere:

npm access grant read-write toverux:sweetalert2 @toverux/sweetalert2

Note the added toverux: before the team.


(Kat Marchán) #3

This is fixed by https://github.com/npm/cli/pull/2, too. Original is a support issue.