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?

[WSL][Cursor][Shopify] WSLでCursor エディタで@shopify/dev-mcp@latest がno tools or no prompts を直す

Posted at

概要

Cursorエディタに@shopify/dev-mcpサーバーを入れようと思ったが
何度やっても no tools or no prompts
と赤点マークになり接続できない。

検証

WindowsでWSL Ubuntu環境を使っていたため
環境の違い= portやIPなど向き先 が原因かと思ったが、

Windowsの場合、CMD or PowerShellで

npx -y @shopify/dev-mcp@latest

を立ち上げる必要があるようのため

まず、CMD or PowerShellでそもそも npx -y @shopify/dev-mcp@latest
が動くか確認が必要。

状況

CMD or PowerShellでは 以下のようなエラーで立ち上がらなかった

$ npx -y @shopify/dev-mcp@latest
npm warn Unknown user config "scripts-prepend-node-path". This will stop working in the next major version of npm.
node:internal/modules/cjs/loader:511
      const err = new Error(
                  ^

Error: Cannot find module 'C:\Users\user\AppData\Local\npm-cache\_npx\8f00c70bd5114901\node_modules\lodash\lodash.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:511:19)
    at Function._findPath (node:internal/modules/cjs/loader:796:18)
    at Function._resolveFilename (node:internal/modules/cjs/loader:1387:27)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
    at Function._load (node:internal/modules/cjs/loader:1211:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1487:12)
    at require (node:internal/modules/helpers:135:16) {
  code: 'MODULE_NOT_FOUND',
  path: '\\\\?\\C:\\Users\\user\\AppData\\Local\\npm-cache\\_npx\\8f00c70bd5114901\\node_modules\\lodash\\package.json',
  requestPath: 'lodash'
}

Node.js v22.16.0

( Node versionを上げたりしてみたが、変化なし..

解決法

要は、Windows のnpmのcache が壊れていたようだ。(エラーにもmoduleファイルがないと 書いてある)

1 . npm キャッシュを強制的にクリアする

コマンドプロンプトまたは PowerShell を管理者権限で開きます。
npm キャッシュ全体を強制的にクリアするには、以下のコマンドを実行します。

npm cache clean --force

2 . 次に、npm cache verify コマンドを使用してキャッシュの整合性を確認します。問題が報告された場合は、修正を試みます。

npm cache verify

3 . 不完全な @shopify/dev-mcp パッケージが抽出された、破損した npx キャッシュディレクトリを削除します。これにより、次回のダウンロード時にクリーンな状態が確保されます。

del /q /s %LocalAppData%\npm-cache\_npx

4 . npx コマンドを再実行します。これにより、npx は破損していない最新の @shopify/dev-mcp とそのすべての依存関係を強制的にダウンロードしてインストールします。

npx -y @shopify/dev-mcp@latest

->
立ち上がった

そして、cursorエディタ側のMCP設定で再度 onにすると
緑点になり 成功!

( 恐らく通信の類で npm-cache というのが不完全だったよう..

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?