nodeschoolがあるよ

コマンド一覧

バージョン選択ツール

nodenv

git clone https://github.com/nodenv/nodenv.git ~/.nodenv
cd ~/.nodenv && src/configure && make -C src
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
git clone https://github.com/nodenv/node-build.git $(nodenv root)/plugins/node-build
nodenv install -l
nodenv install 16.18.0
nodenv local 16.18.0

インストール

nodebrewを使うとrbenvのようにnode.jsのバージョンを選択できる。

EPELからインストール

yum install nodejs.x86_64 --enablerepo=epel
yum install npm.noarch --enablerepo=epel

AmazonLinux

http://qiita.com/Sugima/items/670924901e38cf9eb84a

nodebrew

install

curl -L https://raw.githubusercontent.com/hokaccha/nodebrew/master/nodebrew  | perl  - setup

デフォルトでは$HOME/.nodebrewにインストールされるが、変更したい場合は環境変数を設定しておく

export NODEBREW_ROOT=/path/to/.nodebrew

node.jsのインストール

nodebrew ls-remote
nodebrew install-binary v0.12.0
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

nodebrew lsshow version list(local)
nodebrew ls-remoteshow all version(remote)
nodebrew ls
v0.12.0

current: none
nodebrew use v0.12.0

npm

グローバルのnode_moduleの場所npm root -g
グローバルのnode_moduleパス。PATHに表示結果の場所を通すnpm bin -g
設定値の確認npm config list -l
インストール済みパッケージ表示npm info grunt-cli
バージョン指定してインストールnpm install -g [email protected]
パッケージアンインストールnpm uninstall パッケージ名
gruntインストールnpm install -g grunt-cli

package.jsonの作成

npm init
npm install grunt grunt-contrib-cssmin grunt-contrib-watch --save-dev

不具合

依存関係にあるモジュールをインストールするのだが、一筋縄ではいかないことが多い。 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 [email protected]

設定など

proxy設定

以下のコマンドを打ち込むと~/.npmrcに値が記載される。

npm config set proxy http://proxyIP:3128/
npm config set https-proxy http://proxyIP:3128/
proxy = http://proxyIP:3128/
https-proxy = http://proxyIP:3128/

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-10-29 (土) 08:48:46