Kozanebaの開発環境を作る
2023-01-11
Gitは入れてあった
VSCodeで開く
入れてあった
$ npm start
zsh: command not found: npm
npmがない
$ node -v
zsh: command not found: node
なるほどNodeが入ってない
nvm入れる
nvmでnodeを入れる
$ nvm install --lts
$ node -v
v18.13.0
Node, OK
$ npm install -g npm
% npm -v
9.2.0
npm, OK
% npm start
sh: react-scripts: command not found
$ npm install react-scripts@latest
code::
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
...
npm ERR! Conflicting peer dependency: @types/react@16.14.34
...
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
...
(注: ここはnpm installすべきでは?)
Check out Yarn.
$ npm i -g yarn
$ yarn install
success Saved lockfile.
OK
(注: 問題なく動いたが、そもそもnpm installではダメだったのか?確認せずに進んでしまった)
$ npm start
https://gyazo.com/1ece088f5d6d285b74482f1ffc83f00f
code::
Compiled successfully!
You can now view movidea in the browser.
無事開発環境が動くようになった
本番環境はどこだっけ??
Netlify
https://gyazo.com/eb5f650e05499d8fb3e0676f002b4f67
https://gyazo.com/bbed211e32805f5ee5058434fda828b5
なんか警告出てるな
-----
https://gyazo.com/d54afcbefdc0349da03520d938520011
-----
error expect@29.3.1: The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "12.18.0"
You can choose the Node.js version we use to build your site ...
$ echo "lts/*" > .nvmrc