Node.js: Step by Step

simply run node --version from the command line, and you should see some indication that you're running the latest version of Node which, at this time, is version 6.91. If you see a version print out then you can rest assured that everything went swimmingly and you're ready to write your first Node app.


node --version 

Create package .json

This will initiate a command line questionnaire that will conclude with the creation of a package.json in the directory you initiated the command.
npm init 


  • name: the current directory name
  • version: always 1.0.0
  • description: info from the readme, else an empty string ""
  • main: always index.js
  • scripts: by default creates a empty test script
  • keywords: empty
  • author: empty
  • licenseISC
  • bugs: info from the current directory, if present
  • homepage: info from the current directory, if present


Install Flags

The easier (and more awesome) way to add dependencies to your package.json is to do so from the command line, flagging the npm install command with either --save or --save-dev, depending on how you'd like to use that dependency.
To add an entry to your package.json's dependencies:
npm install <package_names> --save 

Comments

Popular Posts