$ npm i -g @nestjs/cli
added 255 packages, and audited 256 packages in 20s
39 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
インストールができたか確認します
$ which nest
/Users/hogehoge(macにログインしている名前)/.npm-global/bin/nestが返却される
プロジェクトを新規作成
$ nest new project-name
使用するパッケージ管理ツールを聞かれるので選択する。(今回はyarnを選択)
? Which package manager would you ❤️ to use?
npm
❯ yarn
pnpm
? Which package manager would you ❤️ to use? yarn
▹▹▹▸▹ Installation in progress... ☕
Failed to execute command: yarn install --silent
✖ Installation in progress... ☕
🙀 Packages installation failed!
In case you don't see any errors above, consider manually running the failed command yarn install to see more details on why it errored out.
このエラーを確認するとyarn install --silentで失敗していることがわかります。
そこで、ディレクトリを移行して、直接yarn installを実行して、エラーの詳細を確認します。
cd project-name
$ yarn install --silent
error @typescript-eslint/eslint-plugin@5.35.1: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.16.0"
error Found incompatible module.
エラーの内容を確認すると、現在のnodeのバージョンと互換性がないようです。
//エンジン "node "はこのモジュールと互換性がありません
The engine "node" is incompatible with this module.
// 期待されるバージョン "^12.22.0 || ^14.17.0 || >=16.0.0". 14.16.0 "を取得
Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.16.0"
コメント