Help us understand the problem. What is going on with this article?

macOSにnode.jsの開発環境を構築する

More than 1 year has passed since last update.

Alexaのスキルを開発してみようとふと思いつき、node.jsの開発環境を構築します。

環境

macOS High Sierra(10.13)

導入

まずはnode.jsのバージョン管理を行うnodebrewをインストールします。

$ brew install nodebrew
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (caskroom/cask).
No changes to formulae.

==> Downloading https://github.com/hokaccha/nodebrew/archive/v0.9.7.tar.gz
Already downloaded: /Users/hoge/Library/Caches/Homebrew/nodebrew-0.9.7.tar.gz
==> Caveats
You need to manually run setup_dirs to create directories required by nodebrew:
  /usr/local/opt/nodebrew/bin/nodebrew setup_dirs

Add path:
  export PATH=$HOME/.nodebrew/current/bin:$PATH

To use Homebrew's directories rather than ~/.nodebrew add to your profile:
  export NODEBREW_ROOT=/usr/local/var/nodebrew

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/nodebrew/0.9.7: 8 files, 38KB, built in 3 seconds

.bash_profileに下記を追記します。

$ vim ~/.bash_profile
export PATH=$HOME/.nodebrew/current/bin:$PATH

インストール前にダウンロードフォルダ~/.nodebrew/srcがあるか確認します。ない場合は作成します。

$ mkdir ~/.nodebrew
$ mkdir ~/.nodebrew/src

nodebrewを使う準備ができましたので、AWS Lambdaがサポートしているバージョンをインストールします。(今回はv6.10.3をインストールします)
Lambda 実行環境と利用できるライブラリ

$ nodebrew install-binary v6.10.3
$ nodebrew use v6.10.3
$ node -v
v6.10.3
$ npm -v
3.10.10

以上です。
早くAmazon echo来ないかな・・・。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away