-Node.jsについて *コマンド一覧 [#i8b3994b] *インストール [#m55df346] nodebrewを使うとrbenvのようにnode.jsのバージョンを選択できる。 **AmazonLinux [#oae92006] http://qiita.com/Sugima/items/670924901e38cf9eb84a *nodebrew [#e66896f7] **install [#z7871826] curl -L https://raw.githubusercontent.com/hokaccha/nodebrew/master/nodebrew | perl - setup デフォルトでは$HOME/.nodebrewにインストールされるが、変更したい場合は環境変数を設定しておく export NODEBREW_ROOT=/path/to/.nodebrew **node.jsのインストール [#b09ce3ee] -インストールできるバージョンの確認 nodebrew ls-remote -インストール nodebrew install-binary v0.12.0 -当たり前だが、gccが必要。ないときは以下のエラーが出てしまう。 Node.js configure error: No acceptable C compiler found! Please make sure you have a C compiler installed on your system and/or consider adjusting the CC environment variable if you installed it in a non-standard prefix. python ./configure Node.js configure error: No acceptable C compiler found! Please make sure you have a C compiler installed on your system and/or consider adjusting the CC environment variable if you installed it in a non-standard prefix. python tools/gyp_node.py -f make gyp: Undefined variable node_tag in /home/buildusr01/.nodebrew/src/v0.10.27/node-v0.10.27/node.gyp make: *** [out/Makefile] Error 1 **usage [#vda2cd06] |nodebrew ls|show version list(local)| |nodebrew ls-remote|show all version(remote)| nodebrew ls v0.12.0 current: none nodebrew use v0.12.0 *npm [#f869c527] |グローバルのnode_moduleの場所|npm root -g| |グローバルのnode_moduleパス。PATHに表示結果の場所を通す|npm bin -g| |設定値の確認|npm config list -l| |インストール済みパッケージ表示|npm info grunt-cli| |バージョン指定してインストール|npm install -g npm@1.4.25| |パッケージアンインストール|npm uninstall パッケージ名| |gruntインストール|npm install -g grunt-cli| **package.jsonの作成 [#we0995a7] -対話的に作成 npm init -パッケージインストールと同時に作成 --save-dev npm install grunt grunt-contrib-cssmin grunt-contrib-watch --save-dev **不具合 [#o97f3bae] 依存関係にあるモジュールをインストールするのだが、一筋縄ではいかないことが多い。 unmet dependencyとでていたらそのモジュールはインストールできていない。 grunt-contrib-imageminをインストールしたが、imagemin-gifsicleがインストールされず、手動インストール I solved this by going into grunt-contrib-imagemin/node_modules/imagemin and perform: npm install imagemin-gifsicle@ just substitute with the latest version number from https://www.npmjs.com/package/imagemin-gifsicle npm install -g imagemin@0.4.9 *設定など [#ke2e15d4] **proxy設定 [#td8e1237] 以下のコマンドを打ち込むと~/.npmrcに値が記載される。 -コマンド npm config set proxy http://proxyIP:3128/ npm config set https-proxy http://proxyIP:3128/ -~/.npmrcの中身 proxy = http://proxyIP:3128/ https-proxy = http://proxyIP:3128/