Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

3
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 5 years have passed since last update.

yarn -v でYarnのバージョンを確認しようとしたら、Error: EACCES: permission denied, open '/Users/ユーザー名/.config/yarn'と出てくる時の対処法

Posted at

Yarnのバージョンを確認しようとしたらエラーが

バージョンの確認のため、次のコマンドを打ち込む。

$ yarn -v

すると次のエラーが発生。

Error: EACCES: permission denied, open '/Users/ユーザー名/.config/yarn'
    at Object.openSync (fs.js:462:3)
    at readFileSync (fs.js:364:35)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:101331:58
    at Array.map (<anonymous>)
    at parseRcPaths (/usr/local/lib/node_modules/yarn/lib/cli.js:101329:78)
    at Object.findRc (/usr/local/lib/node_modules/yarn/lib/cli.js:101343:10)
    at getRcConfigForCwd (/usr/local/lib/node_modules/yarn/lib/cli.js:56915:74)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:92694:56
    at Generator.next (<anonymous>)
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)

権限がなくて拒否されていると言われてる。

解決法

一旦ホームディレクトリに戻り、.configを確認してみる。

$ cd
$ ls -la

(上略)
drwx------   3 root  staff     96  4  8 16:42 .config
(下略)

現在のユーザーで.configの権限を持っていないようなので、.configフォルダの所有者を現在のユーザーに変更する。

$ sudo chown -R $USER ~/.config/

もう一度確認。

$ ls -la

(上略)
drwx------   3 ユーザー名  staff     96  4  8 16:42 .config
(下略)

rootからユーザー名に変わっているので、大丈夫そう。
アプリのフォルダに戻る。

$ cd /アプリのフォルダ

今一度Yarnのバージョンを確認。

$ yarn -v
1.22.4

ちゃんとバージョンが出てきました!

--- #### 参考URL yarnでエラー - http://shinriyo.hateblo.jp/entry/2018/02/17/yarn%E3%81%A7%E3%82%A8%E3%83%A9%E3%83%BC chown - ファイルの所有者やグループを変更 - Linuxコマンド - https://webkaru.net/linux/chown-command/
3
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

Qiita Advent Calendar is held!

Qiita Advent Calendar is an article posting event where you post articles by filling a calendar 🎅

Some calendars come with gifts and some gifts are drawn from all calendars 👀

Please tie the article to your calendar and let's enjoy Christmas together!

3
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?