-
Notifications
You must be signed in to change notification settings - Fork 27
Wrong npm version in GitHub actions #535
Copy link
Copy link
Open
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels