How to configure npm package.json? Did I do it right, and what function do the following sections "main": "index.js" perform "main": "index.js" , "devDependencies" and "scripts" ?


 { "name": "progectapi2", //Имя проекта "version": "1.0.0", //Версия вашего проекта "description": "test", //Описание проекта "main": "index.js", //Исходный файл npm, или чего именно? "dependencies": { //Зависимости для загрузки пакетов "sass": "^0.5.0" }, "devDependencies": {}, // Точно не известно, вроде бы для публикации "scripts": { // Какой то тест скриптов "test": "echo \"Error: no test specified\" && exit 1" }, "author": "My_Name", //Имя автора "license": "UNLICENSED"//Лицензия } 
  • I think this should help you. - Darth
  • Did you read the documentation ? =) - Dmitriy Simushev
  • Dmitriy Simushev - for me there is not everything is clear. - Niko_D

1 answer 1

You can perform the basic setup simply by running npm init in the root of the project. And devDependencies is a project dependency dev. When installing something via npm you can use the --save-dev flag and this package will be written to devDependencies , this is useful so that another person deploying a project can npm install necessary devDependencies using the npm install devDependencies . main used to allow your package to be loaded in the form of require("mainpackname") In scripts you can write commands that can be run via npm your command. Example "start": "node app.js" will make available the command for you npm start . But it is better, though, to read the documentation thoughtfully.