LoginSignup
59
62

More than 5 years have passed since last update.

npm init で package.json を生成

Last updated at Posted at 2012-12-26

npm init すると、質問に答えるだけで package.json を作ることができます。node_modules に入っているパッケージを dependencies に勝手に入れてくれたりも。

また、後でパッケージを追加するときに、入れてみないと最新のバージョンがわからない時があります。

$ npm install foo -save
or
$ npm install foo -S

とすると、インストールしつつ、そのバージョンで package.json の dependencies に書き足してくれて便利です。

$ npm install foo -save-dev
or
$ npm install foo -D

とすると、devDependencies に書き足してくれます。テストライブラリなど開発中にしか使わないものに使います。

59
62
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
59
62