Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during npm publish: maxAge must be a number #479

Open
robert-wettstaedt opened this issue May 6, 2022 · 4 comments
Open

Error during npm publish: maxAge must be a number #479

robert-wettstaedt opened this issue May 6, 2022 · 4 comments

Comments

@robert-wettstaedt
Copy link

Upgrading semantic-release like this:

    "@semantic-release/exec": "^6.0.3",
    "@semantic-release/git": "^10.0.1",
-   "@semantic-release/gitlab": "^7.0.4",
+   "@semantic-release/gitlab": "^9.2.0",
-   "@semantic-release/npm": "^8.0.3",
+   "@semantic-release/npm": "^9.0.1",
-   "semantic-release": "^18.0.1",
+   "semantic-release": "^19.0.2"

Suddenly resulted in the following error for my package:

$ semantic-release
[9:41:37 AM] [semantic-release] › ℹ  Running semantic-release version 19.0.2
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "verifyRelease" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/gitlab"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/gitlab"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/exec"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/gitlab"
[9:41:37 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ✔  Run automated release from branch dev on repository https://gitlab-ci-token:[secure]@<GITLAB_URL>/<PATH>.git
[9:41:43 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[9:41:43 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/gitlab"
[9:41:43 AM] [semantic-release] [@semantic-release/gitlab] › ℹ  Verify GitLab authentication (https://<GITLAB_URL>/api/v4)
[9:41:43 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/gitlab"
[9:41:43 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/npm"
[9:41:43 AM] [semantic-release] [@semantic-release/npm] › ℹ  Verify authentication for registry https://<GITLAB_URL>/api/v4/projects/[secure]/packages/npm/
[9:41:43 AM] [semantic-release] [@semantic-release/npm] › ℹ  Reading npm config from /builds/<PATH>/.npmrc
[9:41:43 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/npm"
[9:41:43 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/git"
[9:41:43 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/git"
[9:41:43 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ℹ  Found git tag v4.0.0-dev.23 associated with version 4.0.0-dev.23 on branch dev
[9:41:43 AM] [semantic-release] › ℹ  Found 1 commits since last release
[9:41:43 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[9:41:43 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: trigger release
[9:41:43 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[9:41:43 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 1 commits complete: patch release
[9:41:43 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[9:41:43 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ℹ  The next release version is 4.0.0-dev.24
[9:41:43 AM] [semantic-release] › ℹ  Start step "verifyRelease" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ✔  Completed step "verifyRelease" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:41:43 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:41:43 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/exec"
[9:41:43 AM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/npm"
[9:41:43 AM] [semantic-release] [@semantic-release/npm] › ℹ  Write version 4.0.0-dev.24 to package.json in /builds/<PATH>
v4.0.0-dev.24
[9:41:44 AM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/npm"
[9:41:44 AM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/git"
[9:41:44 AM] [semantic-release] [@semantic-release/git] › ℹ  Found 1 file(s) to commit
[9:41:44 AM] [semantic-release] [@semantic-release/git] › ℹ  Prepared Git release: v4.0.0-dev.24
[9:41:44 AM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/git"
[9:41:44 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:41:44 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[9:41:45 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/exec"
[9:41:45 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/exec"
[9:41:45 AM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/exec"
[9:41:45 AM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/exec"
[9:41:46 AM] [semantic-release] › ✔  Created tag v4.0.0-dev.24
[9:41:46 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/gitlab"
[9:41:46 AM] [semantic-release] [@semantic-release/gitlab] › ℹ  Published GitLab release: v4.0.0-dev.24
[9:41:46 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/gitlab"
[9:41:46 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/npm"
[9:41:46 AM] [semantic-release] [@semantic-release/npm] › ℹ  Publishing version 4.0.0-dev.24 to npm registry on dist-tag dev
npm notice 
npm notice package: <PACKAGE_NAME>@4.0.0-dev.24
npm notice === Tarball Contents === 
<...>
npm notice === Tarball Details === 
npm notice name:          <PACKAGE_NAME>                           
npm notice version:       4.0.0-dev.24                            
npm notice filename:      <PACKAGE_NAME>-4.0.0-dev.24.tgz          
npm notice package size:  216.5 kB                                
npm notice unpacked size: 1.0 MB                                  
npm notice total files:   126                                     
npm notice 
npm notice Publishing to https://<GITLAB_URL>/api/v4/projects/[secure]/packages/npm/
npm ERR! maxAge must be a number
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-05-06T09_41_46_662Z-debug-0.log
    at makeError (/builds/<PATH>/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/builds/<PATH>/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async module.exports (/builds/<PATH>/node_modules/@semantic-release/npm/lib/publish.js:30:5)
    at async validator (/builds/<PATH>/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /builds/<PATH>/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next (/builds/<PATH>/node_modules/p-reduce/index.js:16:18) {
  shortMessage: 'Command failed with exit code 1: npm publish /builds/<PATH> --userconfig /tmp/5d26999763b262fcf7a6b7915eb439fa/.npmrc --tag dev --registry https://<GITLAB_URL>/api/v4/projects/[secure]/packages/npm/',
  command: 'npm publish /builds/<PATH> --userconfig /tmp/5d26999763b262fcf7a6b7915eb439fa/.npmrc --tag dev --registry https://<GITLAB_URL>/api/v4/projects/[secure]/packages/npm/',
  escapedCommand: 'npm publish "/builds/<PATH>" --userconfig "/tmp/5d26999763b262fcf7a6b7915eb439fa/.npmrc" --tag dev --registry "https://<GITLAB_URL>/api/v4/projects/[secure]/packages/npm/"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: <...>
[9:41:47 AM] [semantic-release] › ✖  Failed step "publish" of plugin "@semantic-release/npm"
[9:41:47 AM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 1: npm publish /builds/<PATH> --userconfig /tmp/5d26999763b262fcf7a6b7915eb439fa/.npmrc --tag dev --registry https://<GITLAB_URL>/api/v4/projects/[secure]/packages/npm/

Downgrading back to the previous package versions gets rid of the error. Nothing else about the repo config has changed.

@hendrikbursian
Copy link

hendrikbursian commented Jun 15, 2022

Same issue for me. Since the upgrade to 9.0.1 the error is occuring.
For me it happens during the npm version step within the nested package backend but not the root package. All package.json files contain "private": true.

When running the failed command npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version manually in both packages I don't get any errors.

npm --version
6.14.17
node --version
v14.19.2
// filename: release.config.js

const config = {
  branches: [
    {
      name: "master",
    },
    {
      name: "develop",
      channel: "dev",
      prerelease: "dev",
    },
  ],
  plugins: [
    // ...

    ["@semantic-release/npm", { pkgRoot: "." }],
    ["@semantic-release/npm", { pkgRoot: "backend" }],

   // ...
  ],
};

module.exports = config;

Log with --debug

[8:09:56 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/npm"
[8:09:56 PM] [semantic-release] [@semantic-release/npm] › ℹ  Write version 2.0.0-dev.1 to package.json in /home/[hidden]/develop
v2.0.0-dev.1
[8:09:56 PM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/npm"
[8:09:56 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/npm"
[8:09:56 PM] [semantic-release] [@semantic-release/npm] › ℹ  Write version 2.0.0-dev.1 to package.json in [hidden]/develop/backend
backend
v2.0.0-dev.1
npm ERR! maxAge must be a number

npm ERR! A complete log of this run can be found in:
npm ERR!    [hidden]/.npm/_logs/2022-06-15T18_09_56_444Z-debug-0.log
[8:09:57 PM] [semantic-release] › ✖  Failed step "prepare" of plugin "@semantic-release/npm"
[8:09:57 PM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 1: npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version
npm ERR! maxAge must be a number

npm ERR! A complete log of this run can be found in:
npm ERR!     [hidden]/.npm/_logs/2022-06-15T18_09_56_444Z-debug-0.log
backend
v2.0.0-dev.1
    at makeError ([hidden]/develop/node_modules/execa/lib/error.js:60:11)
    at handlePromise ([hidden]/develop/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async module.exports ([hidden]/develop/node_modules/@semantic-release/npm/lib/prepare.js:22:3)
    at async prepare ([hidden]/develop/node_modules/@semantic-release/npm/index.js:68:3)
    at async validator ([hidden]/develop/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async [hidden]/develop/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next ([hidden]/develop/node_modules/p-reduce/index.js:16:18) {
  shortMessage: 'Command failed with exit code 1: npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version',
  command: 'npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version',
  escapedCommand: 'npm version 2.0.0-dev.1 --userconfig "/tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc" --no-git-tag-version --allow-same-version',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: 'backend\nv2.0.0-dev.1',
  stderr: 'npm ERR! maxAge must be a number\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +
    'npm ERR!     [hidden]/.npm/_logs/2022-06-15T18_09_56_444Z-debug-0.log',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: '@semantic-release/npm'
}
Error: Command failed with exit code 1: npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version
npm ERR! maxAge must be a number

npm ERR! A complete log of this run can be found in:
npm ERR!     [hidden]/.npm/_logs/2022-06-15T18_09_56_444Z-debug-0.log
backend
v2.0.0-dev.1
    at makeError ([hidden]/develop/node_modules/execa/lib/error.js:60:11)
    at handlePromise ([hidden]/develop/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async module.exports ([hidden]/develop/node_modules/@semantic-release/npm/lib/prepare.js:22:3)
    at async prepare ([hidden]/develop/node_modules/@semantic-release/npm/index.js:68:3)
    at async validator ([hidden]/develop/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async [hidden]/develop/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async Promise.all (index 0)
    at async next ([hidden]/develop/node_modules/p-reduce/index.js:16:18) {
  shortMessage: 'Command failed with exit code 1: npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version',
  command: 'npm version 2.0.0-dev.1 --userconfig /tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc --no-git-tag-version --allow-same-version',
  escapedCommand: 'npm version 2.0.0-dev.1 --userconfig "/tmp/7e9899c4dc3a435d94f4ed7db6adee1c/.npmrc" --no-git-tag-version --allow-same-version',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: 'backend\nv2.0.0-dev.1',
  stderr: 'npm ERR! maxAge must be a number\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +
    'npm ERR!     [hidden]/.npm/_logs/2022-06-15T18_09_56_444Z-debug-0.log',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: '@semantic-release/npm'
}% 

@hendrikbursian
Copy link

Update: I downgraded @semantic-release/npm to version 9.0.0 and it worked again.

[8:35:10 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/npm"
[8:35:10 PM] [semantic-release] [@semantic-release/npm] › ℹ  Skip publishing to npm registry as package.json's private property is true
[8:35:10 PM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/npm"
[8:35:10 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/npm"
[8:35:10 PM] [semantic-release] [@semantic-release/npm] › ℹ  Skip publishing to npm registry as package.json's private property is true

That should narrow it down.

@emilyrohrbough
Copy link

Introduced by: c817a88

@Tchekda
Copy link

Tchekda commented May 24, 2023

Introduced by: c817a88

Is there any fix available except downgrading the package ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants