npm / npm/cli

[BUG] Installing latest npm downgraded me from 7 to 6 and now I can't install anything

Open
#3,848 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

I tried to publish a package and got:

npm ERR! 426 Upgrade Required - PUT http://registry.npmjs.org/@shaderfrog%2fglsl-parser

Ok I guess it's time. According to: https://github.blog/2021-02-02-npm-7-is-now-generally-available/

Please note, npm 7 is now published as latest to the npm registry and will be the default version installed when you run npm install --global npm

Cool. So I tried:

$ npm --version
7.21.1

$ nvm ls
->      v16.2.0
         system
default -> 16 (-> v16.2.0)
node -> stable (-> v16.2.0) (default)
iojs -> iojs- (-> N/A) (default)

$ npm install --global npm
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/

removed 69 packages, and changed 103 packages in 1m

$ npm --version
6.13.0

You can see it downgraded my npm from 7 to 6, and now I can't do anything due to npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY errors on any npm networking commands.

Expected Behavior

Installing npm to install npm 7 and remove the TLS errors.

Steps To Reproduce
  1. On any environment afaik
  2. Node 16 installed by nvm
  3. Run npm install --global npm from the official instructions

Then your npm is downgraded to 6.

Environment
  • OS: MacOS
  • Node: Node 16 via nvm
  • npm: Broken

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the reported commands with Node 16 installed through nvm, checking the npm version before and after npm install --global npm. Investigate why the global install selects npm 6 and produces certificate errors; done means the official install path keeps npm 7 and npm networking commands work without the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.