2

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.

Michel
  • 10,303
  • 17
  • 82
  • 179
  • @michael It seem to a problem of intsallation, how you have installed the npm or node previusly. Because if u do npm i -g npm, it simple update. I have also update like this only – Abhay Feb 18 '20 at 04:27
  • 1
    Seems like some of the update files already exist due to your previous attempts. Notice the `run npm with --force to overwrite files recklessly.`... I would try it. -- This said, I don't know. – Louys Patrice Bessette Feb 18 '20 at 04:37
  • I installed using the package in https://nodejs.org/en/download/. – Michel Feb 18 '20 at 04:41
  • Have you tried using nvm? Just another option is all. I would delete node/npm and start over wither way. – Binary101010 Feb 18 '20 at 09:32

0 Answers0