GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow to set a custom npm version with `npm_version` option · Issue #213 · actions/setup-node

Allow to set a custom npm version with npm_version option #213

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Allow to set a custom npm version with npm_version option#213
Copy link
Assignees
v-priyagupta108
Labels
feature requestNew feature or request to improve the current logic

Description

@robertsLando
robertsLando
opened on Nov 18, 2020
Issue body actions

Is there a way to setup the action to use npm 7?

What about npm_version: 7 like actually it's done for node_version?

Reacted by Merwan Rodriguez, Seghir Nadir, Sandor, RoboPhred, Iddan Aaronsohn, Mykhailo Gorianskyi, Tiago de Souza Santos, Andreas Herd, Chee Aun, Moritz Wolf and 123 more

Activity

Next
  1. maxim-lobanov commented on Dec 7, 2020

    @maxim-lobanov
    maxim-lobanov
    on Dec 7, 2020
    Contributor
    More actions

    Hello!
    npm is integrated to Node.JS.
    NPM 7.x is integrated to Node.JS 15.x. If you specify Node.JS 15.x, NPM 7 will be selected. See details on https://nodejs.org/en/download/releases/

    If you need npm 7 for previous versions of Node.JS, please consider upgrading it in runtime via npm install -g npm@latest

    Reacted by loucadufault, sandstrom and HermannGruber
  2. robertsLando commented on Dec 7, 2020

    @robertsLando
    robertsLando
    on Dec 7, 2020
    Author
    More actions

    @maxim-lobanov Would it be possible to make it configurable like I suggested by using an option? It would allow to easily use matrix too

  3. josephfrazier
    added a commit that references this issue on Dec 8, 2020

    Use Node 15 with bundled npm 7, see actions/setup-node#213

    320e3b2
  4. smorimoto commented on Dec 12, 2020

    @smorimoto
    smorimoto
    on Dec 12, 2020
    More actions

    Is it not enough to add npm_version to the matrix and manipulate the workflow? I don't think it's a good idea to add more input than necessary.

    Reacted by Daniel Lando, Sean, Roma(nna) Koval and Ryan Wilke
  5. mendrik commented on Dec 28, 2020

    @mendrik
    mendrik
    on Dec 28, 2020
    More actions

    npm publish doesn't work with node 15.x in github actions:

    npm ERR! code ENEEDAUTH
    npm ERR! need auth This command requires you to be logged in.
    npm ERR! need auth You need to authorize this machine using `npm adduser`
    

    when I downgrade to node 12 it works again

  6. dmitry-shibanov commented on Dec 29, 2020

    @dmitry-shibanov
    dmitry-shibanov
    on Dec 29, 2020
    Contributor
    More actions

    Hello @mendrik , the issue with publishing is caused by updating npm to 7th version in node 15. The first minor and patch version of npm 7th had the issue with _auth. It was fixed in next versions. You can use npm with node 12th or upgrade npm to the latest one npm install -g npm@latest

    Reacted by Andreas Herd, David Vurbs and Rico Kahler
  7. Fryuni commented on Jan 15, 2021

    @Fryuni
    Fryuni
    on Jan 15, 2021
    More actions

    It seems setting node-version: 15 now gets a release with the proper fix. It is working without having to update npm

    Reacted by Jonathan Prass Martins
    Reacted by Jeong Jinwoo, Andreas Herd, hata6502 and Jonathan Prass Martins
  8. vinayakkulkarni commented on Feb 16, 2021

    @vinayakkulkarni
    vinayakkulkarni
    on Feb 16, 2021
    More actions

    Just like we have an option to use node versions, we should also have an option to choose npm versions

    Reacted by Busticated, Jason Adams, Peter Juras, Felipe Castillo, parachvte, Nigel Jones, Thomas Mullen, Vladyslav Zubko, Johnson Liang, Jayden Seric and 85 more
    Reacted by Joe Pea, Hui Chang, Daniel Lando, René Eschke, Dmitri, Pascal Betting, Param Siddharth, Ivan Coronado, yaeszlo, tystar and 8 more
  9. fcastilloec commented on Mar 10, 2021

    @fcastilloec
    fcastilloec
    on Mar 10, 2021
    More actions

    Using npm install -g npm@latest with Github Actions gives errors regarding write-access permissions. Installing locally npm i npm@latest will change the repository and mess up any actions that depend on a clean git repo. Any ideas on how to fix this? How can I use npm@7 with node@14? Using node@15 is not an option, sorry...

    Reacted by Kang Huang, Alex Bea, Dmitri and Dan Stanley
  10. smorimoto commented on Mar 10, 2021

    @smorimoto
    smorimoto
    on Mar 10, 2021
    More actions

    What about doing with sudo?

    Reacted by Felipe Castillo, David Wheatley, Mingwei Samuel, Brad Ackerman and Mario Kozjak
  11. fcastilloec commented on Mar 10, 2021

    @fcastilloec
    fcastilloec
    on Mar 10, 2021
    More actions

    @smorimoto I don't know why I didn't think about it! So, running sudo i -g npm@latest after setup-node action does nothing...
    Here's part of the log (can't provide a link to the full log because it's a private repo):

    2021-03-10T18:20:25.6852244Z ##[group]Run sudo npm i -g npm@latest
    2021-03-10T18:20:25.6852862Z sudo npm i -g npm@latest
    2021-03-10T18:20:25.6906055Z shell: /usr/bin/bash -e {0}
    2021-03-10T18:20:25.6906509Z env:
    2021-03-10T18:20:25.6906931Z   node-version: 14
    2021-03-10T18:20:25.6907390Z ##[endgroup]
    2021-03-10T18:20:37.6677894Z /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
    2021-03-10T18:20:37.6683622Z /usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
    2021-03-10T18:20:37.7550998Z + [email protected]
    2021-03-10T18:20:37.7552906Z added 59 packages from 24 contributors, removed 241 packages and updated 194 packages in 10.209s
    2021-03-10T18:20:37.7743170Z ##[group]Run echo npm version "$(npm --version)"
    2021-03-10T18:20:37.7743827Z echo npm version "$(npm --version)"
    2021-03-10T18:20:37.7744307Z echo node version "$(node --version)"
    2021-03-10T18:20:37.7790961Z shell: /usr/bin/bash -e {0}
    2021-03-10T18:20:37.7791313Z env:
    2021-03-10T18:20:37.7791661Z   node-version: 14
    2021-03-10T18:20:37.7792014Z ##[endgroup]
    2021-03-10T18:20:38.3912711Z npm version 6.14.11
    2021-03-10T18:20:38.3966163Z node version v14.16.0

    You can see that after updating npm to version 7, GitHub Actions still uses version 6. Any ideas what to do?

    I've never had to use sudo before when working with nvm. I'm wondering if updating npm with sudo did it for the system installed version and not the one used by nvm? In order to update the nvm one, we might need to run the command without sudo but that gives us errors about writing permissions...

    SOLUTION: After some trial and error, I figure it out. Updating npm before using this action requires sudo but updating it after using this action doesn't require sudo. As I suspected, when running the command with sudo the system version gets updated, not the one use by this action. So for anybody having the same problem as me, make sure you update npm AFTER running this action and without using sudo

    Reacted by Nelson Martell, Yehyoung Kang, Arun Reddy, AkshayRajput, Wildan M, Tom Zhang, Christopher Hirt, electrovir and José Pacheco
  12. smorimoto commented on Mar 10, 2021

    @smorimoto
    smorimoto
    on Mar 10, 2021
    More actions

    I suspect that the path priority is wrong. The following command should tell you the order, but it probably shows the one installed by the action at the top.

    which --all npm
    

    If it's true, you need to change the priority, but it can be a little tricky. For example, create a new directory, create a symbolic link to npm, and add it to the path through the Actions command.

  13. smorimoto commented on Mar 10, 2021

    @smorimoto
    smorimoto
    on Mar 10, 2021
    More actions

    SOLUTION: After some trial and error, I figure it out. Updating npm before using this action requires sudo but updating it after using this action doesn't require sudo. As I suspected, when running the command with sudo the system version gets updated, not the one use by this action. So for anybody having the same problem as me, make sure you update npm AFTER running this action and without using sudo

    Oh, it's good.

  14. rdipardo
    added a commit that references this issue on Mar 29, 2021

    Bump node runtime on CI runners

    1f0ae00
  15. davwheat
    added a commit that references this issue on Apr 3, 2021

    Use npm ci again, but bump npm to v7 as recommended in actions/setup-…

    b35a24f
  16. 29 remaining items

  17. masakudamatsu
    added 3 commits that reference this issue on Sep 25, 2022

    ci(npm): use Node 15 for running tests on CI

    8e97ffc

    ci(npm): use Node 15 for running tests on CI

    98614fe

    ci(npm): use Node 15 for running tests on CI

    7878b40
  18. arvinxx
    added a commit that references this issue on Dec 24, 2022

    🔧 chore: try to fix release

    f22b99b
  19. dusan-trickovic
    added
    needs eyes
    on Jul 12, 2023
  20. dusan-trickovic
    removed
    needs eyes
    on Aug 24, 2023
  21. deining
    added a commit that references this issue on Nov 9, 2023

    chore(deps-dev): bump @typescript-eslint/eslint-plugin (actions#213)

    c4fb7bb
  22. robertsLando
    changed the title [-]`npm_version` for npm 7 support[/-] [+]`npm_version` for npm custom version support[/+] on Feb 8, 2024
  23. robertsLando
    changed the title [-]`npm_version` for npm custom version support[/-] [+]Allow to set a custom npm version with `npm_version` option[/+] on Feb 8, 2024
  24. robertsLando commented on Feb 8, 2024

    @robertsLando
    robertsLando
    on Feb 8, 2024
    Author
    More actions

    @fregante Done

    Reacted by fregante
  25. nickserv commented on Feb 9, 2024

    @nickserv
    nickserv
    on Feb 9, 2024
    More actions

    Note that Node is considering removing npm and having corepack install it, which would make this unnecessary if corepack was implemented.

  26. TrejGun commented on Jan 25, 2025

    @TrejGun
    TrejGun
    on Jan 25, 2025
    More actions

    Hey, there!

    On my local machine, I am using macOS with Node installed via NVM. In GitHub Actions, I use the following setup:

    - uses: actions/setup-node@v4
      with:
        node-version: 22
        cache: 'npm'

    I don't actively switch npm versions and rely on the version installed with Node. Apparently, this isn't sufficient because my NX project works locally but fails in CI.

    I found a solution in this Stack Overflow question: link

    - run: npm update

    However, I’m still unsure about which npm version I am actually using and would prefer to control it via the npm_version option.
    I aslo believe it should be called pm_version, and it should also work for other package managers like Yarn.

    Reacted by Mikey Gray, José Pacheco and Caio Augusto Araújo Oliveira
  27. v-priyagupta108
    self-assigned this
    on Aug 31, 2026
  28. v-priyagupta108 commented on Aug 31, 2026

    @v-priyagupta108
    v-priyagupta108
    on Aug 31, 2026
    Contributor
    More actions

    Thanks for the request and for the long-running discussion here.

    setup-node provisions the Node.js toolchain, and npm comes bundled with each Node.js distribution. Pinning npm separately would make this action responsible for cache-key correctness, precedence against the packageManager field, and a Node-by-npm compatibility matrix. That's a significant expansion of scope for something already achievable in one step:

    - uses: actions/setup-node@v7
      with:
        node-version: '24'
    - run: npm i -g npm@12   # or npm@latest, or [email protected] to pin exactly

    This works for older majors as well as newer ones, and keeps the ordering explicit and visible in the workflow.

    Given that, we're not planning to add an npm-version input. Closing as not planned, but happy to revisit if there's a case the workaround genuinely can't cover.

    Reacted by fregante, Will Slattum and Nicky McCurdy
  29. v-priyagupta108
    closed this as not plannedon Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @v-priyagupta108
    v-priyagupta108

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.