语义发布无法发布到 npm

semantic-release fails to publish to npm

我正在使用语义发布 npm 模块在 circle ci 中进行发布。我收到以下错误

[semantic-release] [@semantic-release/npm] › ℹ Write version 1.0.0 to package.json in /home/circleci/tmp npm ERR! Version not changed, might want --allow-same-version

npm ERR! A complete log of this run can be found in: npm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log [3:21:36 PM] [semantic-release] › ✖ Failed step "prepare" of plugin "@semantic-release/npm" [3:21:36 PM] [semantic-release] › ✖ An error occurred while running semantic-release: { Error: Command failed: npm version 1.0.0 --no-git-tag-version npm ERR! Version not changed, might want --allow-same-version

npm ERR! A complete log of this run can be found in: npm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log

at makeError (/home/circleci/tmp/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/home/circleci/tmp/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)   code: 1,   stdout: '',   stderr:    'npm ERR! Version not changed,

might want --allow-same-version\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log\n',
failed: true, signal: null, cmd: 'npm version 1.0.0 --no-git-tag-version', timedOut: false, killed: false, pluginName: '@semantic-release/npm' } { Error: Command failed: npm version 1.0.0 --no-git-tag-version npm ERR! Version not changed, might want --allow-same-version

npm ERR! A complete log of this run can be found in: npm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log

at makeError (/home/circleci/tmp/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/home/circleci/tmp/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)   code: 1,   stdout: '',   stderr:    'npm ERR! Version not changed,

might want --allow-same-version\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log\n',
failed: true, signal: null, cmd: 'npm version 1.0.0 --no-git-tag-version', timedOut: false, killed: false, pluginName: '@semantic-release/npm' }Exited with code 1

我该如何解决这个问题?

错误的发生可能是因为您手动更新了package.json中的版本。你应该让 semantic-release 为你做这件事。

您应该将 package.json 中的版本设置为 0.0.0-dev。如果您想将更新的 package.json 推送到您的存储库,请使用 @sematnic-release/git 插件。