npm / npm/cli

[BUG] Unable to update npm from 6.14.13 -> 7.16.0

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

Nobody has claimed this yet.

Bug Needs Discussion Priority 2 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

Every time I try to update npm 6.14.13 -> 7.16.0 my terminal ignores my commands.

$ npm install -g npm

Unfortunately is not updating my npm version.

Expected Behavior

I expected to be able to update my npm 6.14.13 to 7.16.0

I'm a junior/beginner front end developer and I'd be very appreciative if somebody could help and explain what I'm doing wrong.

Steps To Reproduce

I've had this issue for a few weeks now, and I can't figure how to debug it. In today's case, I was using npm init to work with TailwindCSS. Starting with:

$ npm init -y

Resulting in the following:

mjw@laptop:~/pro2/tailwindCSS-play$ npm init -y
Wrote to /home/mjw/pro2/tailwindCSS-play/package.json:

{
  "name": "tailwindCSS-play",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │      New major version of npm available! 6.14.13 → 7.16.0      │
   │   Changelog: https://github.com/npm/cli/releases/tag/v7.16.0   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

As the fancy terminal art suggested, I ran:

$ npm install -g npm

Resulting in:

mjw@laptop:~/pro2/tailwindCSS-play$ npm install -g npm
/home/mjw/.npm-global/bin/npx -> /home/mjw/.npm-global/lib/node_modules/npm/bin/npx-cli.js
/home/mjw/.npm-global/bin/npm -> /home/mjw/.npm-global/lib/node_modules/npm/bin/npm-cli.js
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../../../lib/node_modules/npm/man/man1/npx.1
npm ERR! dest /home/mjw/.npm-global/share/man/man1/npx.1
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../../../lib/node_modules/npm/man/man1/npx.1' -> '/home/mjw/.npm-global/share/man/man1/npx.1'
npm ERR! File exists: /home/mjw/.npm-global/share/man/man1/npx.1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mjw/.npm/_logs/2021-06-05T06_04_44_852Z-debug.log

Lots of ERR's, but just to confirm that it didn't go to plan:

$ npm -v 
6.14.13

My next play was to try using --force, as suggested by the terminal.

mjw@laptop:~/pro2/tailwindCSS-play$ npm install -g npm --force
npm WARN using --force I sure hope you know what you are doing.
/home/mjw/.npm-global/bin/npm -> /home/mjw/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/mjw/.npm-global/bin/npx -> /home/mjw/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm@7.16.0
added 255 packages from 922 contributors in 3.925s

Alas, the result remains the same:

$ npm -v
6.14.13

I tried again, I sure wish I knew what I was doing.

mjw@laptop:~/pro2/tailwindCSS-play$ npm install -g --force npm
npm WARN using --force I sure hope you know what you are doing.
/home/mjw/.npm-global/bin/npm -> /home/mjw/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/mjw/.npm-global/bin/npx -> /home/mjw/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm@7.16.0
updated 255 packages in 5.042s

Sigh:

$ npm -v
6.14.13
Environment
  • OS: Ubuntu 20.04
  • Node: 14.17.0
  • npm: 6.14.13

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

No repository file or test is identified. Start by reproducing the npm 6.14.13 to 7.16.0 global update on Ubuntu 20.04 with Node 14.17.0, then inspect the npm executable and PATH involved in npm -v. Done means the reported EEXIST failure is understood and the requested npm version is selected successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.