Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Wrong npm version in GitHub actions

Open
#535 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
github-actions, javascript, nodejs, shell
Domain
ci-cd, release, tooling

Research direction

Start with the provided GitHub Actions workflow and release.config.js, then trace how @semantic-release/exec launches the prepareCmd. Reproduce the two npm -v results in the shown setup-node@v6 configuration and determine why the command does not use the configured npm version. Done means the prepare command runs with the intended npm version in the workflow.

Written by the indexing model from the issue text.

Description

With the introduction of Trusted Publishers it is now important to use npm >= 11 to avoid errors. Setting up a simple GH action

jobs:
  publish:
    runs-on: ubuntu-latest
    name: Release
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: '24'

      - run: npm -v
      - run: npx semantic-release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

And my release.config.js set like this:

export default {
        // ....
	plugins: [
                // ...
		[
			'@semantic-release/exec',
			{
				prepareCmd: 'npm -v'
			}
		]
	]
}

The logs will show two completely different npm versions 11.12.1 and 10.9.2. Attempting to explicitly set the shell with shell: '/bin/bash' or executing the command bash -c 'npm -v' does not solve the issue. My impression is that exec commands are running outside the execution environment set by the actions/setup-node@v6.

Dominant language
JavaScript
Stars
164
Forks
28
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from semantic-release/exec

All issues in semantic-release/exec

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.