インストール中
始める前に、 Node.js 0.10 以上がインストールされていることを確認してください。 次に、アプリケーションのディレクトリを作成し、その中に移動します。
mkdir myappcd myappnpm init コマンドを使用して、アプリケーション用の package.json ファイルを作成します。
package.json がどのように動作するかについては、npm の package.json handling を参照してください。
npm initこのコマンドを実行すると、アプリケーションの名前やバージョンなど、さまざまなものが表示されます。 今のところ、RETURNを押すと、ほとんどのデフォルトを受け入れることができます。以下の例外があります。
entry point: (index.js)app.js、またはメインファイルの名前を何でも入力します。 index.jsにしたい場合は、RETURNを押して、推奨されるデフォルトのファイル名を受け入れます。
次に、Expressをmyappディレクトリにインストールし、依存関係リストに保存します。 例:
npm install expressExpress を一時的にインストールし、依存関係リストに追加しないでください。
npm install express --no-saveBy default with version npm 5.0+, npm install adds the module to the dependencies list in the
package.json file; with earlier versions of npm, you must specify the --save option
explicitly. Then, afterwards, running npm install in the app directory will automatically
install modules in the dependencies list.