0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Macで [ npm install -g npm-check-updates ] が実行できない

Last updated at Posted at 2021-06-26

自分用メモなので、ざっくりと書きます。

前書き

Mac上でnpm installを実行したときに下記エラーが発生
どうやら諸々古くて脆弱性が発生しているから直せとのこと。

7 high severity vulnerabilities

ちなみにどのパッケージが古いのか教えてくれるコマンドはこちら

$ npm audit

パッケージが古ければ諸々アップデートを行えばいい
というのが今回の本編までの経緯

本編

この記事を参考にNPM内パッケージをアップデートしようとしたときにエラー発生

実行コマンド.
npm install -g npm-check-updates

発生したエラー

local@Local sample % npm install -g npm-check-updates
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:

どうやら原因としては、アップデート用のPKG?をインストールを試みたが、インストールディレクトリに書き込み権限がないよ ということらしい。

sudo コマンドを使えば解決o(≧▽≦)o

もう一度コマンド実行

実行コマンド.
$ sudo npm install -g npm-check-updates

今度は成功したようだ?

local@Local sample % sudo npm install -g npm-check-updates
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
/usr/local/bin/ncu -> /usr/local/lib/node_modules/npm-check-updates/bin/cli.js
/usr/local/bin/npm-check-updates -> /usr/local/lib/node_modules/npm-check-updates/bin/cli.js
+ npm-check-updates@11.7.1
added 314 packages from 166 contributors in 13.642s

※WARNとなっている箇所は書いてないので他を当たってくれると助かる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?