Setup Nodejs

Setup Nodejs

Setup Node.js Development Environment and Debugging

Fb7edc7cc7a53c903af74d07dcecf9dc?s=128

Revath S Kumar

January 25, 2014
Tweet

Transcript

  1. SETUP NODE.JS DEV ENVIRONMENT & DEBUGGING

  2. ABOUT Rubyist / JavaScripter Yeoman team member Works at @whatznear

    Blog at blog.revathskumar.com Twitter/Github - @revathskumar
  3. INSTALLATION s u d o a d d - a

    p t - r e p o s i t o r y p p a : c h r i s - l e a / n o d e . j s s u d o a p t - g e t u p d a t e s u d o a p t - g e t i n s t a l l n o d e j s
  4. NOW, INSTALLING PACKAGES REQUIRES SUDO

  5. SET ENV VARIABLE TO AVOID SUDO m k d i

    r ~ / . n p m - p a c k a g e s e c h o ' p r e f i x = ~ / . n p m - p a c k a g e s ' > > ~ / . n p m r c Add to ~ / . z s h r c or ~ / . b a s h r c N P M _ P A C K A G E S = " ~ / . n p m - p a c k a g e s " N O D E _ P A T H = " $ N P M _ P A C K A G E S / l i b / n o d e _ m o d u l e s : $ N O D E _ P A T H " P A T H = " $ N P M _ P A C K A G E S / b i n : $ P A T H " / / b i n p a t h
  6. NVM : NODE VERSION MANAGER

  7. NVM-INSTALL h t t p s : / / r

    a w . g i t h u b . c o m / c r e a t i o n i x / n v m / m a s t e r / i n s t a l l . s h | s h OR g i t c l o n e g i t : / / g i t h u b . c o m / c r e a t i o n i x / n v m . g i t ~ / . n v m . ~ / . n v m / n v m . s h
  8. INSTALLING NODE n v m i n s t a

    l l v 0 . 1 0 . 2 4
  9. USING NVM n v m u s e v 0

    . 1 0 . 2 4 n v m a l i a s d e f a u l t v 0 . 1 0 . 2 4 n v m u n i n s t a l l v 0 . 1 0 . 2 4 n v m r u n v 0 . 1 0 . 2 4 i n d e x . j s
  10. ALTERNATIVELY USE N A V E Virtual Environments for Node

    github.com/isaacs/nave
  11. NPM : NODE PACKAGE MANAGER

  12. NPM : INSTALL PACKAGE n p m i n s

    t a l l y o
  13. NPM : INSTALL GLOBALLY n p m i n s

    t a l l - g y o
  14. NPM : DEPENDENCY MANAGEMENT { " d e v D

    e p e n d e n c i e s " : { " g r u n t " : " ~ 0 . 4 . 1 " , " g r u n t - c o n t r i b - c o n n e c t " : " ~ 0 . 5 . 0 " , " g r u n t - c o n t r i b - w a t c h " : " ~ 0 . 5 . 3 " , " g r u n t - c o n t r i b - c o p y " : " ~ 0 . 4 . 1 " , " g r u n t - c o n t r i b - j s h i n t " : " ~ 0 . 7 . 0 " , " l o a d - g r u n t - t a s k s " : " ~ 0 . 2 . 0 " , " g r u n t - c o f f e e l i n t " : " 0 . 0 . 7 " , " c o n n e c t - l i v e r e l o a d " : " ~ 0 . 2 . 0 " } , " d e p e n d e n c i e s " : { } }
  15. NPM : NEW MODULE n p m i n i

    t
  16. REQUIRE YOUR MODULE n p m l i n k

  17. NPM : UTILITIES n p m u n i n

    s t a l l y o n p m i n s t a l l g e n e r a t o r - b a c k b o n e - - s a v e n p m i n s t a l l m o c h a - - s a v e - d e v n p m l s - - d e p t h = 0
  18. DEBUGGING n o d e - - d e b

    u g s e t B r e a k p o i n t ( ' i n d e x . j s ' , 2 3 ) / / s b ( ' i n d e x . j s ' , 2 3 )
  19. NODE-INSPECTOR github.com/node-inspector/node-inspector using the Blink Developer Tools Have a web

    interface to watch, set beakpoints, live editing `npm install -g node-inspector```
  20. NODEMON Monitor for changes and restart the server n p

    m i n s t a l l - g n o d e m o n n o d e m o n . / s e r v e r . j s l o c a l h o s t 8 0 8 0 Supports coffee
  21. SOURCES github.com/joyent/node/wiki/Installing-Node.js-via-package- manager github.com/sindresorhus/guides/blob/master/npm-global- without-sudo-linux.md Node Inspector : github.com/dannycoates/node-inspector Nodemon

    : github.com/remy/nodemon
  22. None