Skip to content

[BUG] npm install -g npm removes npm command #611

Closed
@mshibanami

Description

@mshibanami

What / Why

npm command is removed after running npm install -g npm.

When

  • 2019/12/18
  • I can't remember exactly when I succeeded in running this command but at least a week ago.

Where

  • npm/cli

How

Current Behavior

This is the log:

~
% brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-13.3.0_1.catalina.bottle.tar.gz
Already downloaded: /Users/manabu/Library/Caches/Homebrew/downloads/8a482358c0487b3ffeeebf4d1f3b3ca825018f6318ecdd6368fd0a6f45e0bea1--node-13.3.0_1.catalina.bottle.tar.gz
==> Pouring node-13.3.0_1.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/node/13.3.0_1: 4,663 files, 59MB

~
% npm install -g npm
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/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/npm-access.1
npm ERR! dest /usr/local/share/man/man1/npm-access.1
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../../../lib/node_modules/npm/man/man1/npm-access.1' -> '/usr/local/share/man/man1/npm-access.1'
npm ERR! File exists: /usr/local/share/man/man1/npm-access.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!     /Users/manabu/.npm/_logs/2019-12-18T07_51_00_280Z-debug.log

I confirmed that this happened again when I ran brew reinstall node.

Actually as the output said, I successfully ran it with --force but I think that just showing these logs is better than removing the npm command.

Edit (2020/01/11):

Actually as the output said, I successfully ran it with --force

More specifically, I did these steps:

  1. Restore npm command that was removed by npm install -g npm
    • Since I use Homebrew for managing Node.js, I ran brew reinstall node to restore it
  2. Run npm install -g --force npm as the output mentioned

Steps to Reproduce

  • n/a

Expected Behavior

  • Updating npm is successful

Who

  • n/a

References

  • n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions