Install Nuxt3 | ERR! @parcel watcher
環境
- windws11
- node => v20.11.0
- npm => 10.4.0
- nuxt => 3.10.1
install
公式の手順に従っていく。
Installation · Get Started with Nuxt
上記を実行すると、エラーが発生した。
npm ERR! gyp ERR! cwd C:~\node_modules@parcel\watcher
エラーを見てみると@parcel\watcher あたりが怪しい気がする。
@parcel/watcherはどうやらファイルの監視を行うnpmパッケージらしい。オプションで設定ができるようにNuxt3に標準装備されているっぽい。
Set an alternative watcher that will be used as the watching service for Nuxt. Nuxt uses chokidar-granular by default, which will ignore top-level directories (like node_modules and .git) that are excluded from watching. You can set this instead to parcel to use @parcel/watcher, which may improve performance in large projects or on Windows platforms. You can also set this to chokidar to watch all files in your source directory.
https://nuxt.com/docs/guide/going-further/experimental-features#watcher
Nuxt のウォッチングサービスとして使用される代替のウォッチャーを設定します。Nuxt はデフォルトで chokidar-granular を使用しており、ウォッチから除外されたトップレベルのディレクトリ(node_modules や .git など)を無視します。代わりに @parcel/watcher を使用するようにこれを設定することができます。これにより、大規模なプロジェクトや Windows プラットフォームでのパフォーマンスが向上する場合があります。また、ソースディレクトリ内のすべてのファイルをウォッチするようにこれを chokidar に設定することもできます。
この時点で何も気にせずにnpm installをしていたら問題なく起動していたかもしれないけど、試してないのでわからない。
「エラーが出た、気になる」ということで検索してみると、
running into errors installing Nuxt3 Inint nuxt 3 project fails with npm package
同様のエラーに遭遇しているひとも結構いるっぽい。
解決方法
大本営のリポジトリでも、Unable to install with command failed sh -c node-gyp rebuildのようにissue標記されているが、Nuxtの問題じゃないと言われている。で、その上の過程Unable to install with command failed sh -c node-gyp rebuildでもプルリクが出されている。
で、色々たらい回しされ、Unable to install with command failed sh -c node-gyp rebuildで、
If you add the following to package.json then do a clean install does it work?
"overrides": { "@parcel/watcher": "2.1.0" },
という希望が示されていたので、実行してみた。
インストールも成功し、
で無事にサーバーも起動した。
なんとなく気分の良くないインストール体験だった。
React主義だけど、より一層React主義になった。開発体験で挽回してくれることに期待している。
Discussion in the ATmosphere