semantic-release / npm

:ship: semantic-release plugin to publish a npm package
MIT License
242 stars 114 forks source link

incompatible with pnpm monorepo #470

Open NullVoxPopuli opened 2 years ago

NullVoxPopuli commented 2 years ago

I recently converted a monorepo from yarn to pnpm, and now publishing won't happen.

4:36:23 PM] [semantic-release] [@semantic-release/npm] › ℹ  Verify authentication for registry https://registry.npmjs.org
[4:36:23 PM] [semantic-release] [@semantic-release/npm] › ℹ  Reading npm config from /home/nullvoxpopuli/.npmrc
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nullvoxpopuli/.npm/_logs/2022-04-09T20_36_24_000Z-debug-0.log
[4:36:24 PM] [semantic-release] › ✖  Failed step "verifyConditions" of plugin "@semantic-release/npm"
[4:36:24 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
browniebroke commented 2 years ago

I have the same error with npm workspaces. The traceback points at this line: https://github.com/semantic-release/npm/blob/4b33e5bc8e051822aa79654e76bdd82c2f0452cd/lib/verify-auth.js#L21

Also, I can reproduce locally by logging in, moving into one of the workspace of the monorepo and running: npm whoami

browniebroke commented 2 years ago

The command works fine with npm@8.4 but not with npm@8.5

browniebroke commented 2 years ago

And it seems to be fixed in npm@8.6 (assume it was part of https://github.com/npm/cli/pull/4479)

manast commented 2 years ago

I also have got this error, is there any workaround for this, can we just force the use of npm@8.6 on the plugin?

hongaar commented 1 year ago

Still have this problem with npm 8.19.2:

node@9a0111889c1a: /workspaces/mokr on main [$]
$ cat .npmrc 
workspaces = true

node@9a0111889c1a: /workspaces/mokr on main [$]
$ npm -v
8.19.2

node@9a0111889c1a: /workspaces/mokr on main [$]
$ npm whoami
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-11-24T10_59_40_560Z-debug-0.log

Opened https://github.com/semantic-release/npm/pull/529 to address this

jedwards1211 commented 2 weeks ago

@NullVoxPopuli do you also have the workspaces = true npm config setting like @hongaar? If so you could work around by doing npm config set workspaces=false before running semantic-release, and the title isn't quite right because that setting isn't required for monorepos, it's just an option. I haven't run into this issue on my pnpm monorepos