TechBlog masa

  • Top
  • Posts
  • Profile
2025-02-02
SWE
prettier実行時の”sh: …/node_modules/.bin/prettier: Permission denied”への対応prettier実行時の”sh: …/node_modules/.bin/prettier: Permission denied”への対応
FormatTS / NodeJS

likes: 0

Unsupported Block: table_of_contents
Unsupported Block: link_preview
  1. Permission deniedなので、まずファイルの権限をチェック

プロジェクト内のnode_modulesのprettierを見てみると、実際に実行権がない (xが自分に与えられていない)。excute == x

[miwa]node_modules/prettier[fix/fetch-posts-in-two-step| 3] ls -al bin            
total 8
drwxr-xr-x   3 miwa  staff    96  1 20 20:22 .
drwxr-xr-x  17 miwa  staff   544  1 20 20:22 ..
-rw-r--r--   1 miwa  staff  2237  1 20 20:22 prettier.cjs

 

  1. 権限を変更する

自分(ファイル作成者)にのみ実行権限を与える。

数字は4, 2, 1の順にread, write, excute。

chmod 744 ./bin/prettier.cjs

参考:https://qiita.com/shisama/items/5f4c4fa768642aad9e06

 

  1. Prettier実行してチェック

自分はこれで治った!

breadcrumb予定地
profileCard予定地

SideBarPage

共有ボタン予定地
他ボタン予定地