そんじゃと、ひさしぶりにNodeでプログラミングをしようと思うのだが
Nodeは3年くらい前にインストールしたまんまである。
(ちなみに本記事についてですが、OSはmacOS High Sierraバージョン 10.13.6で操作しています。)
Nodeのバージョンを確認してみる。
node -v v0.11.11
すると、0.x系だったのだけど相当古いみたいだ。
そして、Nodeのバージョンアップは頻繁に行われているみたいだ。
Node.jsのバージョンによる違い
Nodeのサイトをみると推奨版8.x系で、最新版は10.x系になっている。
なので、ボクのPCのNodeは最新とは程遠いバージョンである。
ということで、Nodeを再インストールすることにする。
そして、Web上でそれらの情報を探しているとnodebrewっていうNodeのバージョン管理ソフトウェアがあるみたいなので、それを入れてみることにする。
まず、Nodeのアンインストールを行う。
Nodeのインストールした手順は覚えてないけれど、PC内にあるファイルを見てみると、
2015年9月11日に「node-v0.11.11.pkg」ってファイルをダウンロードしてインストールしたみたいだ。
Web上でアンインストールの方法が見つかったので、その通りに実行してみる。
Mac OS X から Node.js をアンインストールする方法
アンインストールのコマンドを実行する。
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \ | while read i; do sudo rm /usr/local/${i} done
パスワードを聞かれるので入力する。
Password:
次にnpmの削除を実行する。
sudo rm -rf ~/.npm
ひとまず、Nodeのアンインストールは終了。
次にnodebrewをインストールする。
nodebrewのインストール手順は次のサイトを参考にした。
nodebrewでnodeのバージョンを切り替える方法
brew install nodebrew Updating Homebrew... ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae amtk fauna-shell libsignal-protocol-c rbspy angle-grinder fork-cleaner lsusb safe apache-arrow-glib fortio luarocks schema-evolution-manager ark gambit luit serverless aws-es-proxy gcc@7 mariadb@10.2 sfst aws-okta genact micronaut shellharden badtouch geogram miniserve skopeo bat gitlab-gem mk-configure sonarqube-lts bats-core go@1.10 mkcert soundpipe beagle golang-migrate mkl-dnn squashfuse bitwarden-cli goreleaser mongodb@3.6 stm32flash black gptfdisk mysql-client taskell bloaty gradio mysql@5.7 thors-serializer brew-php-switcher graph-tool netdata topgrade cash-cli hapi-fhir-cli nifi-registry triton cglm hcloud node_exporter tunnel circleci helmfile openapi-generator ucloud click howard-hinnant-date pagmo unp64 clozure-cl hyperfine patchelf util-linux cmdshelf imageoptim-cli pcapplusplus vsts-cli cointop infrakit perltidy wcslib confluent-oss jrtplib peru weaver cquery json11 petsc wireguard-go cuba kakoune petsc-complex wiremock-standalone cwlogs keepkey-agent pgweb woff2 deark kubecfg phplint wsk density kubernetes-service-catalog-client phpmyadmin wskdeploy deployer kustomize picat xcodegen dita-ot lf pijul xidel docker-credential-helper-ecr libbitcoin-client prettier xsimd docker-machine-driver-hyperkit libbitcoin-protocol prototool yamllint drafter libde265 pulumi yarn-completion eccodes libheif pygitup zlog eless libimagequant pyside erlang@20 libplctag python-yq eslint libpsl range-v3 ==> Updated Formulae gdbm ✔ doctl imagemagick@6 mpich rtf2latex2e gradle ✔ doitlive imake mpop rtv mongodb ✔ dosbox imapsync mps-youtube rubberband openssl ✔ double-conversion imlib2 mpv ruby-build pyenv ✔ dovecot immortal mpw ruby-install pyenv-virtualenv ✔ draco inetutils mr rust python ✔ dropbear infer mrboom rustup-init readline ✔ druid influxdb mrtg s-nail sqlite ✔ dscanner innoextract mruby s3-backer xz ✔ dspdfviewer innotop msgpack s3cmd abcde dtc inspectrum msitools s3fs abcl dub inspircd mujs s6 abcm2ps duck instead multimarkdown sagittarius-scheme abcmidi dungeon internetarchive mupdf saldl abnfgen duo_unix ios-deploy mupdf-tools samtools abyss duply ios-sim mutt sane-backends ace duti ios-webkit-debug-proxy mvtools saxon ack dvm iozone mydumper sbcl acme dwarfutils iperf mypy sbt acpica dwdiff iperf3 mysql sbt@0.13 activemq dxpy ipfs mysql++ sbtenv adplug dynare ipython mysql-connector-c++ scala adr-tools e2fsprogs ipython@5 mysql-sandbox scala@2.11 advancemame efl isl mysql@5.5 scalapack adwaita-icon-theme eigen iso-codes mysql@5.6 scale2x afflib ejabberd ispc mytop scamper afsctool elasticsearch itex2mml n sccache agda elasticsearch@2.4 ivykis nagios sceptre agedu elasticsearch@5.6 jabba nano schismtracker aircrack-ng elektra jack nanomsg scipy akamai elixir jadx nanomsgxx scm-manager alexjs elm jags nanopb-generator scour algernon elm-format jansson natalie scrcpy allure elvish jbake nativefier scw alluxio emacs jboss-forge nats-streaming-server sdb amazon-ecs-cli embulk jdupes naturaldocs sdcc ammonite-repl emscripten jemalloc ncmpc sdl2_gfx amqp-cpp encfs jena ncmpcpp securefs angband entr jenkins nco selenium-server-standalone angular-cli ephemeralpg jenkins-job-builder ncview seqtk anjuta eprover jenkins-lts ndpi ser2net annie erlang jetty neko sfcgal ansible erlang@18 jetty-runner neo4j sfk ansible-cmdb erlang@19 jfrog-cli-go neofetch shadowsocks-libev ansible-lint esniper jhiccup neomutt shairport-sync ansiweather etcd jhipster neovim shared-mime-info ant etsh jigdo nesc shellcheck ant@1.9 evince jlog nestopia-ue shfmt apache-arrow exercism jooby-bootstrap net-snmp shibboleth-sp apache-drill exiftool joplin netcdf shml apache-flink exim jpeg-archive nethack shogun apache-geode exomizer jpeg-turbo netpbm shyaml apache-opennlp expat jpegoptim newsboat sile apache-spark exploitdb jruby nexus silk apache-zeppelin eye-d3 json-c nfdump simgrid apibuilder-cli f3 json-fortran nghttp2 simutrans apktool faas-cli jsonnet nginx singular apm-server fabio jsonpp ngspice sip app-engine-java fabric jsonrpc-glib nifi sipp app-engine-python fades juju nnn siril appscale-tools fakeroot juju-wait node sjk aptly fantom jump node-build skaffold arangodb fastd jupyter node@6 skafos archey fastme just node@8 skinny archivemount fastqc jvgrep nodeenv skipfish argyll-cms fb-client kafka nomad skktools aria2 fbi-servefiles kaitai-struct-compiler notmuch sleuthkit arm-linux-gnueabihf-binutils fd kallisto npth smali armadillo fdclone kapacitor nsd smlnj armor fdk-aac-encoder kedge nspr snakemake arp-scan fdroidserver keepassc nsq snapcraft arpack feedgnuplot kerl nss snownews artifactory feh kettle ntl softhsm asciidoctor ffmbc keychain ntopng solr asciinema ffmpeg khal ntp sonar-scanner asdf ffmpeg2theora khard nudoku sonarqube asio ffmpeg@2.8 kibana nuget sops ask-cli ffmpegthumbnailer kibana@5.6 numpy sord aspectj ffms2 kitchen-sync nuxeo source-highlight assh fftw knot nvc source-to-image at-spi2-atk fibjs knot-resolver nvi sourcekitten at-spi2-core field3d kompose nvm sourcery atari800 fig2dev konoha nyancat sox atdtool file-formula kontena nzbget spades atk file-roller kops ocaml sparse atlassian-cli filebeat kore ocaml-findlib spdlog atomicparsley fio kotlin ocaml-num speedtest-cli ats2-postiats firebase-cli krakend ocamlbuild sphinx-doc aubio fits krb5 ocamlsdl spigot audacious flac kube-aws ocrmypdf spotbugs auditbeat flann kubectx octave spring-roo augeas flashrom kubeless odpi sqldiff augustus flatcc kubernetes-cli offlineimap sqlite-analyzer automake flintrock kubernetes-helm ohcount sqliteodbc autopep8 flow lablgtk ola sqlmap autossh fluent-bit lammps ompl sqoop avimetaedit fluid-synth landscaper oniguruma squid aws-elasticbeanstalk flyway languagetool open-cobol sratoolkit aws-sdk-cpp fmt lapack open-mesh src aws-shell fn lastpass-cli open-mpi srt awscli fobis latex2rtf open-scene-graph srtp azure-cli folly launch openblas ssh-copy-id b2-tools fontconfig launch4j opencoarrays ssh-permit-a38 babel fonttools lcdf-typetools opencv ssh-vault babeld fop lcm opencv@2 sshguard babl ford ldc opendetex sshrc bacula-fd fossil lean openexr sshtrix ballerina fq lean-cli openfortivpn sslsplit bandcamp-dl freeciv ledger openh264 sslyze baobab freediameter lego openimageio stanford-ner bareos-client freeimage lensfun openjazz stanford-parser baresip freeipmi leptonica openrct2 stella bartycrouch freeling lftp openrtsp stern basex freeradius-server lgogdownloader opensaml stlink bash freetds libarchive opensc stone-soup bash-completion@2 freetype libatomic_ops openshift-cli storm batik freexl libbi openssh streamlink bazel frege libbitcoin openssl@1.1 strongswan bcal fribidi libbitcoin-explorer opentsdb stubby bcftools frugal libbitcoin-server openvdb stunnel bdw-gc fruit libbpg openvpn subnetcalc bear fselect libccd optipng subversion beast fstar libcdr ortp suite-sparse bedops fstrm libcouchbase osc sundials bench fswatch libcue osm-pbf supersonic bento4 fuego libdazzle osm2pgrouting suricata berkeley-db fuse-emulator libdca osm2pgsql svgcleaner bettercap fuseki libdill osmfilter svtplay-dl bgpstream futhark libdmtx osmium-tool swift bibtex2html fwknop libdvbpsi osquery swift-protobuf bibtexconv fwup libebml osrm-backend swiftformat bibutils fzf libedit ott swiftlint binaryen galen libepoxy overmind swimat bind gammaray libetonyek p11-kit syncthing binutils gandi.cli libewf pacapt synfig binwalk gauche libextractor packer sysbench biogeme gauge libfabric packetbeat sysdig bison gcc libfaketime packmol talloc bit gcovr libfixbuf paket tarantool bitcoin gdal libfreehand pam-u2f tarsnap-gui bitrise gdb libgcrypt pam_yubico tbb blackbox gdcm libgit2 pandoc tbox blockhash gdk-pixbuf libgpg-error pandoc-citeproc tectonic bluepill geckodriver libgphoto2 pandoc-crossref tee-clc blueutil gecode libgsf pango telegraf bmake gedit libgsm paps teleport bnd gegl libgweather parallel telnet bochs geoipupdate libhdhomerun parallelstl template-glib bogofilter geos libhttpseverywhere pari tenyr boost geoserver libical parquet-tools tepl boost-bcp get-flash-videos libidn pass termius boost-build get_iplayer libidn2 passenger terraform boost-mpi getdns libimobiledevice pazpar2 terraform_landscape boost-python ghc libiscsi pbrt terragrunt boost-python3 ghostscript liblcf pc6001vx tesseract botan gibo liblwgeom pcb testssl bower giflib libmaa pcb2gcode texmath bowtie2 gifski libmagic pcl tgui brew-cask-completion gimme libmatio pcre2 the_platinum_searcher bro gist libmatroska pdal the_silver_searcher brotli git libmonome pdfgrep thefuck buildifier git-annex libmspub pdfpc tig buku git-archive-all libmwaw pdfsandwich tiger-vnc burp git-cola libmypaint pdftoedn tika bwfmetaedit git-credential-manager libngspice pdftoipe tile38 byacc git-extras libofx pdns timelimit byobu git-fixup libomp pdnsrec tinc byteman git-ftp libosinfo pdsh tippecanoe bzt git-lfs libosmium pegtl titlecase cabextract git-quick-stats libpcap percona-server tj caddy git-secret libpeas percona-server-mongodb tkdiff caf git-sizer libphonenumber percona-server@5.6 tmate caffe git-town libpng percona-toolkit tmux cake gitbucket libpq percona-xtrabackup tmux-xpanes calabash giter8 libpqxx perkeep tmuxinator-completion calicoctl gitlab-runner libpst perl todo-txt camlp4 gitup libqalculate perl-build todolist camlp5 gjs libraw perl@5.18 todoman capnp gjstest librdkafka pgbouncer tokei capstone glib libre pgcli tomcat cargo-completion glib-networking librealsense pgloader tomcat-native carrot2 glibmm librem pgpdump tomcat@7 carthage glm libressl pgplot tomcat@8 cask globus-toolkit librtlsdr pgpool-ii tor cassandra gloox libsass pgroonga tox castxml glslang libsoup phoronix-test-suite tracebox cataclysm glslviewer libsoxr php traefik cayley gmsh libspectre php-code-sniffer trafficserver ccache gmt libspectrum php-cs-fixer transcrypt ccextractor gmt@4 libssh php@5.6 translate-shell ccrypt gnatsd libstfl php@7.0 transmission cdrdao gnome-builder libswiften php@7.1 trash ceres-solver gnu-cobol libtensorflow phpunit travis certbot gnu-indent libtiff pianobar treefrog ceylon gnu-prolog libtomcrypt pianod trezor-agent cfengine gnu-smalltalk libtorrent-rasterbar picard-tools ttfautohint cfitsio gnu-units libtrace pick tty-solitaire cfr-decompiler gnumeric libu2f-host pidgin ttyd cfssl gnupg libu2f-server pike tundra cgal gnupg@1.4 libuninameslist pilosa tup cgrep gnuplot libunistring pioneers twarc chaiscript gnuradio libuv pipenv twoping chakra gnutls libvirt pkcs11-helper twtxt chamber go libvisio planck txr chapel go-bindata libwebsockets plantuml typescript charm go-jira libwps platformio u-boot-tools check_postgres go-statik libxc plenv ubertooth checkbashisms go@1.9 libxkbcommon plowshare uftp checkstyle gobject-introspection libxlsxwriter plplot uhd chrome-cli gobuster libxmlsec1 pmd unbound chronograf gocr libxo pngquant uncrustify cimg gocryptfs libyaml poco unixodbc citus godep libzdb pod2man unpaper cjdns goenv libzip pony-stable unrar ckan goffice lighttpd ponyc upscaledb clac gollum link-grammar poppler uptimed clamav gomplate linkerd postgis upx clang-format google-benchmark links postgresql urbit clblast google-java-format liquibase postgresql@9.4 urh clhep googler liquigraph postgresql@9.5 uriparser cliclick goose lldpd postgresql@9.6 utf8proc clingo gopass llnode postgrest uwsgi cloc gosu llvm pound v8 clojure gource llvm@5 povray vagrant-completion clojurescript gpac lmod ppsspp vala closure-compiler gperftools lnav pqiv valabind cmake gpgme log4cplus pre-commit vapoursynth cmark-gfm gphoto2 logcheck prest varnish@4 cmocka gr-osmosdr logentries presto vault cockroach grafana logstalgia primesieve vcftools cocoapods grails logstash progress vdirsyncer codec2 grakn logtalk proguard veclibfort coffeescript graphene lolcat proj vegeta collectd graphicsmagick loudmouth prometheus verilator collector-sidecar graphite2 lrzsz proselint vert.x commandbox grc lsof protobuf vim compcert grib-api lsyncd protobuf-c vim@7.4 composer gromacs lua protobuf-swift vips conan gron lua@5.1 protobuf@2.6 virtuoso confuse groonga lxc proxychains-ng visp conjure-up groovy lynis proxytunnel vnu conserver groovysdk lynx pspg vowpal-wabbit consul grpc lysp psqlodbc vrpn consul-backinator grunt-cli lz4 pstoedit vte3 consul-template grunt-completion mackup ptex vtk container-diff grv macvim pulseaudio wabt convox gsettings-desktop-schemas mafft pumba wandio coq gsl magic-wormhole purescript wartremover coreos-ct gsoap makeself pushpin watch coreutils gspell mame puzzles watchexec corsixth gssh mapcrafter pxz watson couchdb gst-editing-services mapnik py2cairo webalizer cp2k gst-libav mariadb py3cairo webdis cpanminus gst-plugins-bad mariadb@10.0 pybind11 webp cppcheck gst-plugins-base mariadb@10.1 pycodestyle webpack cppcms gst-plugins-good math-comp pyexiv2 webtorrent-cli credstash gst-plugins-ugly maven pygobject3 weechat creduce gst-python maxwell pyinvoke wesnoth cromwell gst-rtsp-server mbedtls pypy wget cryptol gst-validate mcabber pypy3 whois cryptopp gstreamer mdcat pyqt widelands csvkit gtk+3 mdds python@2 wildfly-as csvprintf gtk-mac-integration mdp pytouhou wine csvtomd gtk-vnc media-info pyvim winetricks ctl gtksourceview3 mediaconch qbs wiredtiger cucumber-cpp gtksourceview@4 mednafen qcachegrind wireguard-tools curl gucharmap megacmd qcli wireshark cython guile megatools qd wla-dx dar gupnp memcached qemu wolfssl darcs gutenberg memcacheq qjackctl wp-cli darksky-weather gws menhir qmmp wpscan dartsim gwyddion mercurial qpdf wrangler dash gx meson qpid-proton wslay datetime-fortran gx-go meson-internal qpm wtf dateutils h2o mesos qrencode wxmac datomic hadolint metabase qrupdate x265 davix hadoop metaproxy qscintilla2 xapian davmail hana metashell qt xdot dbhash handbrake metricbeat qtfaststart xmake dbus haproxy mg qtkeychain xml-security-c dbxml harfbuzz mgba quantlib xml-tooling-c dcd hashcat micro quex xmount dcm2niix haskell-stack micropython quicktype xmrig dcos-cli hbase midnight-commander r xonsh dcraw hdf5 mighttpd2 rabbitmq xqilla ddclient hdf5@1.8 mikutter rabbitmq-c xrootd debianutils heartbeat mill radare2 xsv dehydrated hebcal mimic raine xtensor dep heroku minetest rakudo-star xxhash dependency-check hesiod mingw-w64 rancher-cli yaf derby hevea minidlna ratfor yafc dfix hexgui minimal-racket rawtoaces yara dfmt hfstospell minimesos raylib yarn dhall-json hg-fast-export minisat rclone yash di hh miniupnpc re2 yaws dialog highlight minizinc re2c yaz diamond hive mint reattach-to-user-namespace yelp-tools dict hledger mitmproxy recoverjpeg ykman diff-pdf hlint mkdocs redis ykpers diffoscope homebank mkvtoolnix redis@3.2 yle-dl digdag homeshick mlkit redshift you-get direnv hopenpgp-tools mlt remarshal youtube-dl discount hss mm-common remctl yq dislocker html-xml-utils mmseqs2 reminiscence yubico-piv-tool distcc htmldoc moc rename z3 django-completion htop modd reposurgeon zabbix dlib htslib modules restic zanata-client dmd httpd monax restview zbackup dmtx-utils httpie monero rgbds zbar dnscrypt-proxy hub monetdb rhash zebra dnsdist hugo mongo-c-driver rhino zenity dnstwist hydra mongo-cxx-driver riemann zero-install docfx hyperscan mongo-orchestration riemann-client zimg docker hypre mongodb@3.2 ripgrep zita-convolver docker-completion i2p mongodb@3.4 rmlint zmap docker-compose icarus-verilog mongoose robot-framework znapzend docker-compose-completion icdiff monit rocksdb znc docker-credential-helper ice mono roll zookeeper docker-machine icu4c mosh rom-tools zopfli docker-machine-completion idris mosquitto root zorba docker-squash igv mp3gain roswell zsh docker-swarm ii mpc rpm zsh-autosuggestions docker2aci ilmbase mpd rsstail zsh-completions dockviz imagemagick mpfi rsyslog zstd ==> Renamed Formulae cdiff -> ydiff geth -> ethereum rebar@3 -> rebar3 wpcli-completion -> wp-cli-completion crystal-lang -> crystal latexila -> gnome-latex saltstack -> salt ==> Deleted Formulae artifactory-cli-go boot2docker ecj gpg-agent llvm@3.7 monotone aws-cloudsearch boot2docker-completion ghc@8.0 i3 luciddb node@4 bokken dirmngr gnupg@2.0 i3status mediatomb wry Error: Could not link: /usr/local/share/man/man1/brew.1 Please delete these paths and run `brew update`. Error: Could not link: /usr/local/share/doc/homebrew Please delete these paths and run `brew update`. ==> Downloading https://github.com/hokaccha/nodebrew/archive/v1.0.0.tar.gz ==> Downloading from https://codeload.github.com/hokaccha/nodebrew/tar.gz/v1.0.0 ######################################################################## 100.0% ==> 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/1.0.0: 8 files, 38.4KB, built in 6 seconds
なんか、エラーが出力されている。
Error: Could not link: /usr/local/share/man/man1/brew.1 Please delete these paths and run `brew update`. Error: Could not link: /usr/local/share/doc/homebrew Please delete these paths and run `brew update`. ==> Downloading https://github.com/hokaccha/nodebrew/archive/v1.0.0.tar.gz ==> Downloading from https://codeload.github.com/hokaccha/nodebrew/tar.gz/v1.0.0
Homebrewの設定が悪いみたいだ。
Web上でこれらのエラーの情報を探してみるけど、どうも根本的な解決策らしきものが見当たらない。
ということで、Homebrewを再インストールすることにする。
Homebrewの再インストールの手順は次のサイトを参考にした。
Homebrewがおかしくなったら再インストールしよう
Homebrewをアンインストールする。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" Warning: This script will remove: /Users/[XXXXX]/Library/Caches/Homebrew/ /Users/[XXXXX]/Library/Logs/Homebrew/ /usr/local/.git/ /usr/local/.gitignore /usr/local/.travis.yml /usr/local/.yardopts /usr/local/CODEOFCONDUCT.md /usr/local/CONTRIBUTING.md /usr/local/Cellar/ /usr/local/LICENSE.txt /usr/local/Library/ /usr/local/README.md /usr/local/SUPPORTERS.md /usr/local/bin/brew -> /usr/local/Homebrew/bin/brew /usr/local/share/man/man1/brew.1 Are you sure you want to uninstall Homebrew? This will remove your installed packages! [y/N] y ==> Removing Homebrew installation... ==> Removing empty directories... ==> /usr/bin/sudo /usr/bin/find /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks -name .DS_Store -delete Password: ==> /usr/bin/sudo /usr/bin/find /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks -depth -type d -empty -exec rmdir {} ; ==> Homebrew uninstalled! The following possible Homebrew files were not deleted: /usr/local/.yardopts /usr/local/heroku/ /usr/local/CODEOFCONDUCT.md /usr/local/bin/ /usr/local/.com.apple.installer.keep /usr/local/remotedesktop/ /usr/local/etc/ /usr/local/Homebrew/ /usr/local/var/ /usr/local/Library/ /usr/local/README.md /usr/local/.gitignore /usr/local/CONTRIBUTING.md /usr/local/SUPPORTERS.md /usr/local/lib/ /usr/local/.git/ /usr/local/LICENSE.txt /usr/local/.travis.yml /usr/local/share/ You may wish to remove them yourself.
Homebrewをインストールする。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew ==> The following new directories will be created: /usr/local/include /usr/local/sbin /usr/local/opt /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks Press RETURN to continue or any other key to abort ==> /usr/bin/sudo /bin/mkdir -p /usr/local/include /usr/local/sbin /usr/local/opt /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks Password: ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/include /usr/local/sbin /usr/local/opt /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks ==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions ==> /usr/bin/sudo /usr/sbin/chown [XXXXX] /usr/local/include /usr/local/sbin /usr/local/opt /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/include /usr/local/sbin /usr/local/opt /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks ==> /usr/bin/sudo /bin/mkdir -p /Users/[XXXXX]/Library/Caches/Homebrew ==> /usr/bin/sudo /bin/chmod g+rwx /Users/[XXXXX]/Library/Caches/Homebrew ==> /usr/bin/sudo /usr/sbin/chown [XXXXX] /Users/[XXXXX]/Library/Caches/Homebrew ==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew ==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew ==> /usr/bin/sudo /usr/sbin/chown [XXXXX] /Library/Caches/Homebrew ==> Downloading and installing Homebrew... remote: Counting objects: 38, done. remote: Compressing objects: 100% (20/20), done. remote: Total 38 (delta 10), reused 26 (delta 7), pack-reused 3 Unpacking objects: 100% (38/38), done. From https://github.com/Homebrew/brew 1b4566651..5772493e2 master -> origin/master HEAD is now at 5772493e2 Merge pull request #4895 from MikeMcQuaid/vendor-bundle-standalone ==> Migrating /Library/Caches/Homebrew to /Users/[XXXXX]/Library/Caches/Homebrew... ==> Deleting /Library/Caches/Homebrew... Already up-to-date. ==> Installation successful! ==> Homebrew has enabled anonymous aggregate formulae and cask analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics.html ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Next steps: - Run `brew help` to get started - Further documentation: https://docs.brew.sh
そして、nodebrewをインストールする。
brew install nodebrew Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae gradle ==> Downloading https://github.com/hokaccha/nodebrew/archive/v1.0.0.tar.gz ==> Downloading from https://codeload.github.com/hokaccha/nodebrew/tar.gz/v1.0.0 ######################################################################## 100.0% ==> 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: p 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/1.0.0: 8 files, 38.4KB, built in 5 seconds
今回はエラーが出力されなかった。
nodebrewのコマンドを入力する。
nodebrew nodebrew 1.0.0 Usage: nodebrew help Show this message nodebrew installDownload and install (from binary) nodebrew compile Download and install (from source) nodebrew install-binary Alias of `install` (For backword compatibility) nodebrew uninstall Uninstall nodebrew use Use nodebrew list List installed versions nodebrew ls Alias for `list` nodebrew ls-remote List remote versions nodebrew ls-all List remote and installed versions nodebrew alias Set alias nodebrew unalias Remove alias nodebrew clean | all Remove source file nodebrew selfupdate Update nodebrew nodebrew migrate-package Install global NPM packages contained in to current version nodebrew exec -- Execute using specified Example: # install nodebrew install v8.9.4 # use a specific version number nodebrew use v8.9.4
nodebrewのセットアップをする。
nodebrew setup Fetching nodebrew... Installed nodebrew in $HOME/.nodebrew ======================================== Export a path to nodebrew: export PATH=$HOME/.nodebrew/current/bin:$PATH ========================================
次はNodeのインストールをする。
一応インストールできるNodeのバージョンを見てみる。
nodebrew ls-remote v0.0.1 v0.0.2 v0.0.3 v0.0.4 v0.0.5 v0.0.6 v0.1.0 v0.1.1 v0.1.2 v0.1.3 v0.1.4 v0.1.5 v0.1.6 v0.1.7 v0.1.8 v0.1.9 v0.1.10 v0.1.11 v0.1.12 v0.1.13 v0.1.14 v0.1.15 v0.1.16 v0.1.17 v0.1.18 v0.1.19 v0.1.20 v0.1.21 v0.1.22 v0.1.23 v0.1.24 v0.1.25 v0.1.26 v0.1.27 v0.1.28 v0.1.29 v0.1.30 v0.1.31 v0.1.32 v0.1.33 v0.1.90 v0.1.91 v0.1.92 v0.1.93 v0.1.94 v0.1.95 v0.1.96 v0.1.97 v0.1.98 v0.1.99 v0.1.100 v0.1.101 v0.1.102 v0.1.103 v0.1.104 v0.2.0 v0.2.1 v0.2.2 v0.2.3 v0.2.4 v0.2.5 v0.2.6 v0.3.0 v0.3.1 v0.3.2 v0.3.3 v0.3.4 v0.3.5 v0.3.6 v0.3.7 v0.3.8 v0.4.0 v0.4.1 v0.4.2 v0.4.3 v0.4.4 v0.4.5 v0.4.6 v0.4.7 v0.4.8 v0.4.9 v0.4.10 v0.4.11 v0.4.12 v0.5.0 v0.5.1 v0.5.2 v0.5.3 v0.5.4 v0.5.5 v0.5.6 v0.5.7 v0.5.8 v0.5.9 v0.5.10 v0.6.0 v0.6.1 v0.6.2 v0.6.3 v0.6.4 v0.6.5 v0.6.6 v0.6.7 v0.6.8 v0.6.9 v0.6.10 v0.6.11 v0.6.12 v0.6.13 v0.6.14 v0.6.15 v0.6.16 v0.6.17 v0.6.18 v0.6.19 v0.6.20 v0.6.21 v0.7.0 v0.7.1 v0.7.2 v0.7.3 v0.7.4 v0.7.5 v0.7.6 v0.7.7 v0.7.8 v0.7.9 v0.7.10 v0.7.11 v0.7.12 v0.8.0 v0.8.1 v0.8.2 v0.8.3 v0.8.4 v0.8.5 v0.8.6 v0.8.7 v0.8.8 v0.8.9 v0.8.10 v0.8.11 v0.8.12 v0.8.13 v0.8.14 v0.8.15 v0.8.16 v0.8.17 v0.8.18 v0.8.19 v0.8.20 v0.8.21 v0.8.22 v0.8.23 v0.8.24 v0.8.25 v0.8.26 v0.8.27 v0.8.28 v0.9.0 v0.9.1 v0.9.2 v0.9.3 v0.9.4 v0.9.5 v0.9.6 v0.9.7 v0.9.8 v0.9.9 v0.9.10 v0.9.11 v0.9.12 v0.10.0 v0.10.1 v0.10.2 v0.10.3 v0.10.4 v0.10.5 v0.10.6 v0.10.7 v0.10.8 v0.10.9 v0.10.10 v0.10.11 v0.10.12 v0.10.13 v0.10.14 v0.10.15 v0.10.16 v0.10.17 v0.10.18 v0.10.19 v0.10.20 v0.10.21 v0.10.22 v0.10.23 v0.10.24 v0.10.25 v0.10.26 v0.10.27 v0.10.28 v0.10.29 v0.10.30 v0.10.31 v0.10.32 v0.10.33 v0.10.34 v0.10.35 v0.10.36 v0.10.37 v0.10.38 v0.10.39 v0.10.40 v0.10.41 v0.10.42 v0.10.43 v0.10.44 v0.10.45 v0.10.46 v0.10.47 v0.10.48 v0.11.0 v0.11.1 v0.11.2 v0.11.3 v0.11.4 v0.11.5 v0.11.6 v0.11.7 v0.11.8 v0.11.9 v0.11.10 v0.11.11 v0.11.12 v0.11.13 v0.11.14 v0.11.15 v0.11.16 v0.12.0 v0.12.1 v0.12.2 v0.12.3 v0.12.4 v0.12.5 v0.12.6 v0.12.7 v0.12.8 v0.12.9 v0.12.10 v0.12.11 v0.12.12 v0.12.13 v0.12.14 v0.12.15 v0.12.16 v0.12.17 v0.12.18 v4.0.0 v4.1.0 v4.1.1 v4.1.2 v4.2.0 v4.2.1 v4.2.2 v4.2.3 v4.2.4 v4.2.5 v4.2.6 v4.3.0 v4.3.1 v4.3.2 v4.4.0 v4.4.1 v4.4.2 v4.4.3 v4.4.4 v4.4.5 v4.4.6 v4.4.7 v4.5.0 v4.6.0 v4.6.1 v4.6.2 v4.7.0 v4.7.1 v4.7.2 v4.7.3 v4.8.0 v4.8.1 v4.8.2 v4.8.3 v4.8.4 v4.8.5 v4.8.6 v4.8.7 v4.9.0 v4.9.1 v5.0.0 v5.1.0 v5.1.1 v5.2.0 v5.3.0 v5.4.0 v5.4.1 v5.5.0 v5.6.0 v5.7.0 v5.7.1 v5.8.0 v5.9.0 v5.9.1 v5.10.0 v5.10.1 v5.11.0 v5.11.1 v5.12.0 v6.0.0 v6.1.0 v6.2.0 v6.2.1 v6.2.2 v6.3.0 v6.3.1 v6.4.0 v6.5.0 v6.6.0 v6.7.0 v6.8.0 v6.8.1 v6.9.0 v6.9.1 v6.9.2 v6.9.3 v6.9.4 v6.9.5 v6.10.0 v6.10.1 v6.10.2 v6.10.3 v6.11.0 v6.11.1 v6.11.2 v6.11.3 v6.11.4 v6.11.5 v6.12.0 v6.12.1 v6.12.2 v6.12.3 v6.13.0 v6.13.1 v6.14.0 v6.14.1 v6.14.2 v6.14.3 v6.14.4 v7.0.0 v7.1.0 v7.2.0 v7.2.1 v7.3.0 v7.4.0 v7.5.0 v7.6.0 v7.7.0 v7.7.1 v7.7.2 v7.7.3 v7.7.4 v7.8.0 v7.9.0 v7.10.0 v7.10.1 v8.0.0 v8.1.0 v8.1.1 v8.1.2 v8.1.3 v8.1.4 v8.2.0 v8.2.1 v8.3.0 v8.4.0 v8.5.0 v8.6.0 v8.7.0 v8.8.0 v8.8.1 v8.9.0 v8.9.1 v8.9.2 v8.9.3 v8.9.4 v8.10.0 v8.11.0 v8.11.1 v8.11.2 v8.11.3 v8.11.4 v8.12.0 v9.0.0 v9.1.0 v9.2.0 v9.2.1 v9.3.0 v9.4.0 v9.5.0 v9.6.0 v9.6.1 v9.7.0 v9.7.1 v9.8.0 v9.9.0 v9.10.0 v9.10.1 v9.11.0 v9.11.1 v9.11.2 v10.0.0 v10.1.0 v10.2.0 v10.2.1 v10.3.0 v10.4.0 v10.4.1 v10.5.0 v10.6.0 v10.7.0 v10.8.0 v10.9.0 v10.10.0 io@v1.0.0 io@v1.0.1 io@v1.0.2 io@v1.0.3 io@v1.0.4 io@v1.1.0 io@v1.2.0 io@v1.3.0 io@v1.4.1 io@v1.4.2 io@v1.4.3 io@v1.5.0 io@v1.5.1 io@v1.6.0 io@v1.6.1 io@v1.6.2 io@v1.6.3 io@v1.6.4 io@v1.7.1 io@v1.8.1 io@v1.8.2 io@v1.8.3 io@v1.8.4 io@v2.0.0 io@v2.0.1 io@v2.0.2 io@v2.1.0 io@v2.2.0 io@v2.2.1 io@v2.3.0 io@v2.3.1 io@v2.3.2 io@v2.3.3 io@v2.3.4 io@v2.4.0 io@v2.5.0 io@v3.0.0 io@v3.1.0 io@v3.2.0 io@v3.3.0 io@v3.3.1
インストール可能なバージョンは見たものの、最新バージョンをインストールする。
nodebrew install stable Fetching: https://nodejs.org/dist/v10.10.0/node-v10.10.0-darwin-x64.tar.gz ######################################################################## 100.0% Installed successfully
インストールされたNodeのバージョンを設定する。
nodebrew use v10.10.0
use v10.10.0
次に現在のNodeのバージョンを確認。
すると、エラーが出力。
node -v -bash: node: command not found
この件についても、先程参考したサイトに記載があるね。
nodebrewでnodeのバージョンを切り替える方法
.bashrcファイルをviで開く。
vi ./.bashrc
次のパス設定内容を入力する。
そして保存。
export PATH=$HOME/.nodebrew/current/bin:$PATH
..bash_profile ファイルをviで開く。
vi ./.bash_profile
次のパス設定内容を入力する。
そして保存。
source ~/.bashrc
別ウインドウのTerminalを起動し、現在のNodeのバージョンを確認する。
大丈夫みたいだ。
今回はこれで終わり。
node -v v10.10.0