【解決方法】Yarn1.6.0(Node.js10)でのインストールエラー

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。
Yarn1.6.0(Node.js10)一部のパッケージをインストールしようとした際に下記のようなエラーが出ました。
環境
- Mac OSX 10.13.4
- Yarn 1.6.0
- Node.js 10.0.0
発生したエラー
terminal$ yarn
yarn install v1.6.0
(node:842) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
warning ../package.json: No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
こちらの記事を参考に解決できたのでメモします。
参考 Qiita
https://qiita.com/DQNEO/items/372f20b17af8af8c4d11
原因
原因としてはupath
というライブラリにengines
が指定がされているためです。
json"engines": {
"node": ">=4 <=9"
},
参考 Github
https://github.com/anodynos/upath/blob/3bdcd474017e7635ecbc7509ea03c6b036df3b8d/package.json#L43
解決方法
インストール時に--ignore-engines
のオプションを付与してあげます。
terminal$ yarn install --ignore-engines
yarn install v1.6.0
(node:847) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
warning ../package.json: No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "react-icons > react-icon-base@2.1.0" has unmet peer dependency "prop-types@*".
warning " > redux-devtools-extension@2.13.2" has incorrect peer dependency "redux@^3.1.0".
warning "@zeit/next-css > extract-text-webpack-plugin@3.0.2" has unmet peer dependency "webpack@^3.1.0".
warning " > react-addons-test-utils@15.6.2" has incorrect peer dependency "react-dom@^15.4.2".
[4/4] 📃 Building fresh packages...
✨ Done in 18.81s.
記事Article
もっと見る- article
開発時にで役立つgit stashコマンドの基本と応用テクニックを紹介
- article
React.memoとは?再レンダリングを防ぐための基本と使い方をわかりやすく解説
- article
Reactの再レンダリングを制御する!memo・useMemo・useCallbackの使い分けを紹介
- article
Reactの状態管理2025:「useState」「Redux Toolkit」「Jotai」「Zustand」を比較してみた
- article
Next.jsでの画像最適化戦略:next/image vs 外部CDNを比較してみた
- article
React Server Componentsの可能性と課題を実用に向けて考えてみる