最終更新:2022-11-25 (金) 12:15:32 (71d)
npm install
Top / npm install
Install a package
npm install npm install <package>
パラメータなし
- package.jsonに記載されたパッケージが一括でインストールされる
パラメータ
- The -g or --global argument will cause npm to install the package globally rather than locally. See npm help 5 npm-folders.
フォルダ
ローカル
- npm bin
- Local install (default): puts stuff in ./node_modules of the current package root.
グローバル
- Global install (with -g): puts stuff in /usr/local or wherever node is installed.
- npm bin -g
C:\Users\<ユーザ名>\AppData\Roaming\npm
package.jsonへの追記
npm install
- パッケージリストに保存
npm install <パッケージ名> --save
- By default with version npm 5.0+ npm install adds the module to the dependencies list in the package.json
- むかしはnpm install --saveとしていた
npm install --save-dev
Ubuntuの場合
- sudo npm install -g <パッケージ>
バージョン指定
- npm install grunt@0.3.17
npm updateとの違い
npm install
- 未インストールのパッケージをインストール
- 指定より上バージョンのパッケージが存在してもインストールしない
npm update
- 未インストールのパッケージはインストールしない
- 指定より上バージョンのパッケージが存在すればインストールする