14
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nodebrewを使ってNode.js+expressを入れてみた

Posted at

ほぼNode.js超入門に書かれている通り。

node.jsのバージョン管理ツールnodebrewを入れる。

$ curl -L git.io/nodebrew | perl - setup

nodebrewを使ってstableなnode.jsを入れる。

$ nodebrew ls-remote
...
$ nodebrew install v0.10.25
$ nodebrew use v0.10.25

npmでexpressを入れる。
expressコマンドを使うためにはexpress-generatorを入れないといけないらしい。

$ npm install express -g
$ npm install express-generator -g

パス追加

.zshrc
export PATH="$HOME/.nodebrew/current/bin:$PATH"

テストアプリ作成+実行まで

$ express TestApp
   create : TestApp
   create : TestApp/package.json
   create : TestApp/app.js
   create : TestApp/public
   create : TestApp/public/images
   create : TestApp/public/stylesheets
   create : TestApp/public/stylesheets/style.css
   create : TestApp/routes
   create : TestApp/routes/index.js
   create : TestApp/routes/users.js
   create : TestApp/public/javascripts
   create : TestApp/views
   create : TestApp/views/index.jade
   create : TestApp/views/layout.jade
   create : TestApp/views/error.jade
   create : TestApp/bin
   create : TestApp/bin/www

   install dependencies:
     $ cd TestApp && npm install

   run the app:
     $ DEBUG=my-application ./bin/www

デフォルトポートは3000番
localhost:3000

14
15
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
14
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?