/var/www/yatta47.log

/var/www/yatta47.log

やったのログ置場です。スクラップみたいな短編が多いかと。

nodeのバージョンを上げる

Reactの勉強をしようと思ってコマンドを叩いてみたらそもそもプロジェクトが作れなかった。

$ npx create-react-app react-typescript-weather-app --template typescript
Need to install the following packages:
  create-react-app
Ok to proceed? (y) y
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'create-react-app@5.0.0',
npm WARN EBADENGINE   required: { node: '>=14' },
npm WARN EBADENGINE   current: { node: 'v12.16.1', npm: '7.20.5' }
npm WARN EBADENGINE }
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
You are running Node 12.16.1.
Create React App requires Node 14 or higher.
Please update your version of Node.
npm notice
npm notice New major version of npm available! 7.20.5 -> 8.5.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.2
npm notice Run npm install -g npm@8.5.2 to update!
npm notice
vagrant@development-server: ~/repogitories/github/react-sample $

で、npmのバージョンが足りんというからnpmのバージョンも上げてみたのだが、そもそもnodeのバージョンが古すぎてだめとのこと。

$ npx create-react-app react-typescript-weather-app --template typescript
You are running Node 12.16.1.
Create React App requires Node 14 or higher.
Please update your version of Node.

ってことでnでバージョンを上げることに。

今のバージョンは以下。

$ node -v
v12.16.1

だいぶ古い・・・・

最新のltsにバージョンアップ。

$ sudo n lts

  installing : node-v16.14.0
       mkdir : /usr/local/n/versions/node/16.14.0
       fetch : https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz
   installed : v16.14.0 (with npm 8.3.1)
vagrant@development-server: ~/repogitories/github/react-sample $ node -v
v16.14.0

よし。上がった。新しいことを始める際はだいたい環境更新必要だな。