What does npm init command do and when would you use it?
Experience Level: Junior
Tags: npm
Answer
The command npm init
creates a file package.json.
You can use it whenever you need to create a new Node.js project. When the file exists, you can add a dependency or devDependency to the file and install it using npm.
Related npm job interview questions
Using npm, how do you uninstall a package?
npm JuniorWhere can you find modules that the npm installed locally after you executed the npm install command?
npm JuniorWhat information is stored about every dependency in the npm file package.json?
npm JuniorWhat metadata does the npm file package.json contain?
npm JuniorUsing npm, how do you install project dependencies?
npm Junior