| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
72 バイト追加 、 2020年2月16日 (日) 04:29
編集の要約なし
==[[npm]]==
[[Node.js]] |
*http://qiita.com/hashrock/items/15f4a4961183cfbb2658
===[[npm ]] init===
*プロジェクトのためのディレクトリを作成
*[[npm ]] initを実行
*とりあえず全部エンターキーを押しても問題ありません。
*ディレクトリ直下にpackage.jsonが作成されます。
> [[npm ]] init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `[[npm ]] help json` for definitive documentation on these fields
and exactly what they do.
Use `[[npm ]] install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Is this ok?
===[[npm ]] install===*npmリポジトリからライブラリをダウンロードしてくる。[[npm]]リポジトリからライブラリをダウンロードしてくる。
*ライブラリそのものは下記のサイト
**https://www.npmjs[[npm]]js.com/
*installは、下記の書式
*node_modulesというフォルダ下に、ライブラリが保存
[[npm ]] install パッケージ名
=====saveオプション=====
!オプション
!追記先
!外部したものをnpm 外部したものを[[npm]] install 時
|-
|--save
*ライブラリ同士の依存も自動で解決されます。
> [[npm ]] install -g browserify
<blockquote>-g オプションはパッケージのグローバルインストールを意味します。browserify はいつでも使う便利ツールなのでシステム全体にインストールします。開発中のプロジェクト固有のパッケージをインストールするときは、-g オプションを外せば、プロジェクトフォルダの node_module フォルダ配下にダウンロードされます。</blockquote>
===webpack===
*https://mae.chab.in/archives/2891
===[[npm ]] run===*[[npm ]] scriptsと呼ばれるタスク実行機能を呼び出す
=====package.json=====
{
},
}
=====[[npm ]] run =====
*タスクの一覧
> [[npm ]] run
Lifecycle scripts included in commonjs_lesson:
test
echo "Error: no test specified" && exit 1
=====[[npm ]] run タスク===== > [[npm ]] run test
> commonjs_lesson@1.0.0 test C:\workspaces\vscode\commonjs_lesson

案内メニュー