Full-Stack Web Development with Vue.js and Node

(singke) #1
Introducing MEVN Chapter 1

main: This is the primary entry point used to look for the package. Basically, it is
a file path, so when a user installs this package, it knows where to start looking
for the modules.
scripts: This field consists of commands that can be run for various states in the
application. It has a key-value pair. The key is the event at which the command
should be run and the value is the actual command.
author/contributors: The author and contributors are the people. It contains an
identifier of the person. An author is a single person, whereas contributors can be
a group of people.
license: The license field, when provided, makes it easy for the users to use our
package. This helps in identifying the permissions and restrictions when using
the package.

Creating a package.json file

We can manually create a package.json file and specify the options ourselves, or we can


use a command to create it interactively from the command prompt.


Let's go ahead and initialize a sample application with a package.json using npm.


First, create a folder in your projects directory using the command:


$ mkdir testproject

To create a package.json file, run the following command in the application that we


created:


$ npm init
Free download pdf