Skip to content

[BUG] npx node@12 executes node@16 #4204

Closed

Description

@Kreijstal

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Documentation says you can specify node version with npx, but right now, when using npx node@12 it executes latest version instead

Expected Behavior

Execute latest version

Steps To Reproduce

run npx node@12 with node 16, install it, and then see the version.

Environment

  • npm: 7.24.0
  • Node: v16.10.0
  • OS: Windows 10
  • platform: Acer
  • npm config:
; "builtin" config from C:\Users\k\scoop\apps\nodejs\16.10.0\node_modules\npm\npmrc

cache = "C:\\Users\\k\\scoop\\persist\\nodejs\\cache"
prefix = "C:\\Users\\k\\scoop\\persist\\nodejs\\bin"

; node bin location = C:\Users\k\scoop\apps\nodejs\current\node.exe
; cwd = C:\Users\k\ok\node-ffi-test
; HOME = C:\Users\k
; Run `npm config ls -l` to show all defaults.

Activity

  1. added
    Bug
    Needs Triage
    Release 8.x
    on Jan 2, 2022
  2. ljharb commented on Jan 2, 2022

    @ljharb
    Contributor

    So if you run npx node@12 --version what do you get?

  3. ljharb commented on Jan 2, 2022

    @ljharb
    Contributor

    (not that the node package on npm is a good way to use different versions of node)

  4. Kreijstal commented on Jan 2, 2022

    @Kreijstal
    Author

    npx node@12 --version
    v16.10.0

  5. ljharb commented on Jan 2, 2022

    @ljharb
    Contributor

    You’re on npm 7, can you try on npm 8?

  6. Kreijstal commented on Jan 2, 2022

    @Kreijstal
    Author

    updated node and npm versions

    C:\Users\k\ok\node-ffi-test>npm -v
    8.3.0
    
    C:\Users\k\ok\node-ffi-test>npx node@12 --version
    v17.3.0
    
  7. added
    platform:windows
    on Jan 4, 2022
  8. added
    cmd:exec
    on Jul 25, 2022
  9. wraithgar commented on Aug 3, 2022

    @wraithgar
    Contributor

    This should be fixed as of npm@8.16.0

    ~/D/n/s/npx $ node --version
    v18.6.0
    ~/D/n/s/npx $ npx node@12 --version
    Need to install the following packages:
      node@12.22.12
    Ok to proceed? (y) 
    v12.22.12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageRelease 8.xcmd:execplatform:windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions