What is the purpose of package.json?

 Posted by Rajnilari2015 on 3/7/2016 | Category: Node.js Interview questions | Views: 2810 | Points: 40
Answer:

All npm packages contain a json file which is located at the root of the project. This json file is the package.json .It that holds various metadata (e.g. project description,project dependencies, project version,license information etc. ) relevant to the project. It allows npm to identify the project as well as handle the project's dependencies. A sample package.json may look as under

{

"name": "EmployeeCRUDUsingMERN",
"version": "1.0.0",
"description": "A example of Package.json",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "RNA Team",
"license": "ISC",
"dependencies": {
"browserify": "^12.0.1",
"express": "^4.13.3",
"guid": "0.0.12",
"gulp": "^3.9.0",
"react": "^0.14.5",
"react-dom": "^0.14.5",
"reactify": "^1.1.1",
"vinyl-source-stream": "^1.1.0"
}
}


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response