npmの特定のバージョンをインストールする・サンプルコードで動かしてみる・VSCodeのプラグインをインストール

昨日は大江戸Ruby会議08が開催されて、行けなかった私は起きてからしばらく楽しそうなTLをながめていました。

今朝も「りあクト!」の続きから!

npmの特定のバージョンをインストールする

npmのバージョンが合っていなかったので、npm i -g npm@6.8.0 でインストールしたところ、無事入りました。

しかしその後の npx create-react-app hello-world --typescript でこける。

>> npx create-react-app hello-world --typescript
npx: 99個のパッケージを6.358秒でインストールしました。

Creating a new React app in /Users/katorie/js_ex/hello-world.

The --typescript option has been deprecated and will be removed in a future release.
In future, please use --template typescript.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...

yarn add v1.16.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error @typescript-eslint/eslint-plugin@2.18.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.9.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template-typescript --cwd /Users/katorie/js_ex/hello-world has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting hello-world/ from /Users/katorie/js_ex
Done.

🍊😔

サンプルコードで動かしてみる

https://github.com/oukayuka/ReactBeginnersBook-2.0/tree/master/01-hello/02-hello

サンプルコードを clone して、02-hello ディレクトリで npm i してから npm start すると…

f:id:katoriexxxkatorie:20200212055318p:plain
でた!

VSCodeプラグインをインストール

本の中でおすすめされているプラグインを、ひとまず盲目的にインストール。

  • Prettier(esbenp.prettier-vscode)
  • ESLint(dbaeumer.vscode-eslint)
  • stylelint-plus(hex-ci.stylelint-plus)
  • Visual Studio IntelliCode(VisualStudioExptTeam.vscodeintellicode)
  • Bracket Pair Colorizer(coenraads.bracket-pair-colorizer)
  • indent-rainbow(oderwat.indent-rainbow)
  • vscode-icons(vscode-icons-team.vscode-icons)
  • Debugger for Chrome(msjsdiag.debugger-for-chrome)
  • VSCodeVim(vscodevim.vim)
  • Live Share(ms-vsliveshare.vsliveshare)

明日はこのプラグインたちを確認するところから。