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

# Error: Cannot find module 'playwright/lib/mcp/program.js' の解決方法

Posted at

この記事の対象読者

  • Playwright を npx で実行してモジュールエラーが出た方
  • npx のキャッシュ問題でお困りの方

発生したエラー

Error: Cannot find module 'C:\Users\hatuk\AppData\Local\npm-cache\_npx\9833c18b2d85bc59\node_modules\playwright\lib\mcp\program.js'

原因

npx のキャッシュが破損していました。

npx は一度ダウンロードしたパッケージをキャッシュしますが、このキャッシュが不完全だと必要なファイルが見つからずエラーになります。

解決方法

方法1: キャッシュをクリア(推奨)

npx clear-npx-cache

方法2: グローバルインストール

npm install -g playwright@latest

再発防止

定期的にキャッシュをクリアしましょう

# 月に1回程度
npx clear-npx-cache

よく使うツールはグローバルインストールがおすすめです

npm install -g playwright

参考リンク

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