Node.js環境の構築
Homebrewはインストール済みとする
brew install nodebrew
インストールされた nodebrewのバージョンを確認
nodebrew -v
nodebrew 1.2.0
安定版のnode.jsをインストールする
(base) tanakahda@MacBook-Air ~ % nodebrew install stable Fetching: https://nodejs.org/dist/v18.4.0/node-v18.4.0-darwin-arm64.tar.gz Warning: Failed to create the file Warning: /Users/tanakahda/.nodebrew/src/v18.4.0/node-v18.4.0-darwin-arm64.tar.g Warning: z: No such file or directory curl: (23) Failure writing output to destination download failed: https://nodejs.org/dist/v18.4.0/node-v18.4.0-darwin-arm64.tar.gz
ダウンロードに失敗する... 参考記事:https://qiita.com/kz23szk/items/738972e0b6a3ba0783ba
(base) tanakahda@MacBook-Air ~ % nodebrew install stable Fetching: https://nodejs.org/dist/v18.4.0/node-v18.4.0-darwin-arm64.tar.gz ############################################## 100.0% Installed successfully
(base) tanakahda@MacBook-Air ~ % nodebrew ls v18.4.0 current: none
(base) tanakahda@MacBook-Air ~ % nodebrew use v18.4.0 use v18.4.0
(base) tanakahda@MacBook-Air ~ % nodebrew ls v18.4.0 current: v18.4.0
nodeコマンドのパスを通す
(base) tanakahda@MacBook-Air ~ % node -v zsh: command not found: node
(base) tanakahda@MacBook-Air ~ % echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zshrc (base) tanakahda@MacBook-Air ~ % source ~/.zshrc (base) tanakahda@MacBook-Air ~ % node -v v18.4.0
test という React.js のプロジェクトを作成する
(base) tanakahda@MacBook-Air Desktop % npx create-react-app test
buildする
(base) tanakahda@MacBook-Air test % npm run build > test@0.1.0 build > react-scripts build ・・・
起動する
(base) tanakahda@MacBook-Air test % npm start