⚠️

yarnでRemixをインストール時のエラー

2024/02/04に公開

yarn create remixでRemix追加しようとした時に詰まったので記述。
バージョン: yarn@4.0.2, create-remix@2.6.0

エラー内容

yarn create remix ./                                 
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + create-remix@npm:2.6.0, @nodelib/fs.scandir@npm:2.1.5, @nodelib/fs.stat@npm:2.0.5, and 194 more.
➤ YN0000: └ Completed in 6s 23ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 197 packages were added to the project (+ 32.21 MiB).
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 6s 337ms

/private/var/folders/k0/ng1zfrdn6pjfkx4z_19flb800000gn/T/xfs-46680bd2/dlx-62812/.pnp.cjs:7548
      Error.captureStackTrace(firstError);
            ^

Error: create-remix tried to access fs-extra, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: fs-extra
Required by: create-remix@npm:2.6.0 (via /private/var/folders/k0/ng1zfrdn6pjfkx4z_19flb800000gn/T/xfs-46680bd2/dlx-62812/.yarn/cache/create-remix-npm-2.6.0-b2ac1ee5f3-0cc679547d.zip/node_modules/create-remix/dist/)

fs-extraが必要だと怒られる。
しかし、

yarn add fs-extra

して再び

yarn create remix

をしても同じエラーが出る

解決方法

package.jsonfs-extraの部分をlatestに変更する

dependencies:
    'fs-extra': 'latest'

参考

https://github.com/remix-run/remix/issues/6640

Discussion