dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
200 stars 37 forks source link

pnpm version fails #146

Open MAN-Sendance opened 1 year ago

MAN-Sendance commented 1 year ago

An error occurred while running semantic-release: Error: Command failed with exit code 1: pnpm version 1.1.0 --userconfig /tmp/300395d7faeac44f7e40c406d8e74976/.npmrc --no-git-tag-version --allow-same-version npm ERR! Cannot read properties of null (reading 'matches')

antongolub commented 1 year ago

https://github.com/semantic-release/npm/issues/540

esatterwhite commented 4 months ago

It seems like everyone is pointing the finger at someone else. Do we at least know what the problem is?

esatterwhite commented 4 months ago

For the record, I started seeing the same error w/ npm as well, not pnpm

[2023-09-11T18:31:57.550Z] npm ERR! Cannot read properties of null (reading 'matches')
[2023-09-11T18:31:57.550Z] 
[2023-09-11T18:31:57.550Z] npm ERR! A complete log of this run can be found in:
[2023-09-11T18:31:57.550Z] npm ERR!     /tmp/tooling-semantic-release-2/packages/release-plugin-lua/.npm/_logs/2023-09-11T18_31_35_393Z-debug-0.log
[2023-09-11T18:31:57.550Z] @answerbook/release-plugin-lua
[2023-09-11T18:31:57.550Z] v2.0.1
[2023-09-11T18:31:57.550Z]     at makeError (/tmp/tooling-semantic-release-2/packages/release-config-logdna/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js:60:11)
[2023-09-11T18:31:57.550Z]     at handlePromise (/tmp/tooling-semantic-release-2/packages/release-config-logdna/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js:118:26)
[2023-09-11T18:31:57.550Z]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-09-11T18:31:57.550Z]     at async module.exports (/tmp/tooling-semantic-release-2/packages/release-config-logdna/node_modules/.pnpm/@semantic-release+npm@9.0.2_semantic-release@19.0.5/node_modules/@semantic-release/npm/lib/prepare.js:22:3)
[2023-09-11T18:31:57.550Z]     at async prepare (/tmp/tooling-semantic-release-2/packages/release-config-logdna/node_modules/.pnpm/@semantic-release+npm@9.0.2_semantic-release@19.0.5/node_modules/@semantic-release/npm/index.js:68:3)
[2023-09-11T18:31:57.550Z]     at async validator (/tmp/tooling-semantic-release-2/node_modules/.pnpm/semantic-release@17.4.7/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
[2023-09-11T18:31:57.550Z]     at async /tmp/tooling-semantic-release-2/node_modules/.pnpm/semantic-release@17.4.7/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
[2023-09-11T18:31:57.550Z]     at async Promise.all (index 0)
[2023-09-11T18:31:57.550Z]     at async next (/tmp/tooling-semantic-release-2/node_modules/.pnpm/p-reduce@2.1.0/node_modules/p-reduce/index.js:16:18) {
[2023-09-11T18:31:57.550Z]   shortMessage: 'Command failed with exit code 1: npm version 2.0.1 --userconfig /tmp/d5c619590c32bbda8ce21686d2ec2371/.npmrc --no-git-tag-version --allow-same-version',
[2023-09-11T18:31:57.550Z]   command: 'npm version 2.0.1 --userconfig /tmp/d5c619590c32bbda8ce21686d2ec2371/.npmrc --no-git-tag-version --allow-same-version',
[2023-09-11T18:31:57.550Z]   escapedCommand: 'npm version 2.0.1 --userconfig "/tmp/d5c619590c32bbda8ce21686d2ec2371/.npmrc" --no-git-tag-version --allow-same-version',
[2023-09-11T18:31:57.550Z]   exitCode: 1,
[2023-09-11T18:31:57.550Z]   signal: undefined,
[2023-09-11T18:31:57.550Z]   signalDescription: undefined,
[2023-09-11T18:31:57.550Z]   stdout: '@answerbook/release-plugin-lua\nv2.0.1',
[2023-09-11T18:31:57.550Z]   stderr: 'npm WARN ignoring workspace config at /tmp/tooling-semantic-release-2/packages/release-plugin-lua/.npmrc \n' +
[2023-09-11T18:31:57.550Z]     "npm ERR! Cannot read properties of null (reading 'matches')\n" +
[2023-09-11T18:31:57.550Z]     '\n' +
[2023-09-11T18:31:57.550Z]     'npm ERR! A complete log of this run can be found in:\n' +
[2023-09-11T18:31:57.550Z]     'npm ERR!     /tmp/tooling-semantic-release-2/packages/release-plugin-lua/.npm/_logs/2023-09-11T18_31_35_393Z-debug-0.log',
[2023-09-11T18:31:57.550Z]   failed: true,
[2023-09-11T18:31:57.550Z]   timedOut: false,
[2023-09-11T18:31:57.550Z]   isCanceled: false,
[2023-09-11T18:31:57.550Z]   killed: false,
[2023-09-11T18:31:57.550Z]   pluginName: 'Inline plugin'
[2023-09-11T18:31:57.550Z] }
esatterwhite commented 4 months ago

@MAN-Sendance @dhoulb is the problem the workspaces key in package json? I have

"workspaces": [
    "packages/*"
  ]

which is valid for pnpm/multi semantic release but not npm.

I also have in the pnpm-workspace

packages:
  - 'packages/**'
  - '!**/test/**'
  - '!scripts/**'

is this enough for multi-semantic-release to work? can I just remove the workspaces key from package.json

esatterwhite commented 4 months ago

I think this may have been it, for me at least. removing workspaces from the root project package.json and relying only on the pnpm-workspace file seems to have fixed this error.

prisis commented 3 weeks ago

You could use https://www.npmjs.com/package/@anolilab/semantic-release-pnpm/v/latest no need to use 2 package manager anymore