Vueでアプリ開発をやっている最中、「グラフ描画のためにchartJSを入れよう!」と思いパッケージをインストールしようとした時の話。
こんなエラーが出ました。
$ npm install vue-chartjs chart.js
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '@eslint/eslintrc@1.2.2',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint@8.14.0',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint-plugin-vue@8.7.1',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint-scope@7.1.1',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint-visitor-keys@3.3.0',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'espree@9.3.1',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint-visitor-keys@3.3.0',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'vue-eslint-parser@8.3.0',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint-scope@7.1.1',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'eslint-visitor-keys@3.3.0',
npm WARN EBADENGINE required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' },
npm WARN EBADENGINE current: { node: 'v14.15.0', npm: '7.6.2' }
npm WARN EBADENGINE }
added 2 packages, and audited 913 packages in 2s
98 packages are looking for funding
run `npm fund` for details
エラー文を読み解くと、どうやら今使っているnodeのバージョンが古く、eslint関連のパッケージと相性が悪いらしいです。
今回の場合、必要なバージョンが
required: { node: '^12.22.0 || ^14.17.0 || >=16.0.0' }
に対し、今使っているnodeのバージョンが、
current: { node: 'v14.15.0', npm: '7.6.2' }
となっています。
つまり、今使っているnodeのバージョンを、requiredに書いてあるnodeのバージョンを満たすように変更してあげる必要があるということですね。
自分はnodebrewで管理しているので、以下コマンドで安定版にアップデートしました。
// nodebrewのアップデート
$ nodebrew install-binary stable
そして再度パッケージをインストールしてみます。
$ npm install vue-chartjs chart.js
added 23 packages, and audited 24 packages in 5s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
無事インストールできました。
コメント