Node.jsでアプリケーションフォルダを作成する方法を入門者向けにサンプルコード付きでまとめました。
## アプリケーションフォルダの作成
Node.jsでアプリケーションフォルダを作成してみます。
① ターミナル(Windowsならコマンドプロンプト)を開きます。
③ 以下のコマンドを順に実行します。
mkdir myapp cd myapp npm init
| – | 補足 |
|---|---|
| 1行目 | アプリケーションフォルダの作成(myapp:任意のフォルダ名) |
| 2行目 | 作成したアプリケーションフォルダへ移動 |
| 3行目 | アプリケーションの初期化 |
④「npm init」を実行すると以下のように設定を求められます。
今回は練習なのでひたすらEnterを実行し、最後にyesを実行します。
package name: (myapp) [Enter]
version: (1.0.0) [Enter]
depreion: [Enter]
entry point: (index.js) [Enter]
test command: [Enter]
git repository: [Enter]
keywords: [Enter]
author: [Enter]
license: (ISC) [Enter]
About to write to C:\Users\panzer4\myapp\package.json:
{
"name": "myapp",
"version": "1.0.0",
"depreion": "",
"main": "index.js",
"pres": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes) [yes]
| – | 関連ページ |
|---|---|
| 1 | ■【Node.js入門】サンプル集と使い方まとめ |

コメント