When handling an Node.js project, I run the npm install
command.
Things happen and I get this message at the end:
╭────────────────────────────────────────────────────────────────╮
│ │
│ New patch version of npm available! 6.13.4 → 6.13.7 │
│ Changelog: https://github.com/npm/cli/releases/tag/v6.13.7 │
│ Run npm install -g npm to update! │
│ │
╰────────────────────────────────────────────────────────────────╯
Thinking it is always good to update to the last version, I run (as advised):
Shell-Prompt$ npm install -g npm
......
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/bin-links
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/env-paths
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/get-caller-file
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/invert-kv
......
As one can see there are a few issues. Beside the fact that I don't see why I get these write access problems; indeed there was no recommendation to run the command as root (or similar advice); I keep going and try:
Shell-Prompt$ sudo npm install -g npm
Hoping all is going to go well. But here is the result:
/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-bin.1
npm ERR! dest /usr/local/share/man/man1/npm-bin.1
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../../../lib/node_modules/npm/man/man1/npm-bin.1' -> '/usr/local/share/man/man1/npm-bin.1'
npm ERR! File exists: /usr/local/share/man/man1/npm-bin.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/me/.npm/_logs/2020-02-18T02_57_36_473Z-debug.log
Running:
Shell-Prompt$ rm /usr/local/share/man/man1/npm-bin.1
Only makes npm unavailable.
To sum it up. What is the way to follow the advice about the patch?
New patch version of npm available! 6.13.4 → 6.13.7
Without running into so much trouble.