by Sai gowtham

How to solve the npm WARN package.json: No repository field

In this tutorial, we are going to learn about how to fix the npm warn No repository field warning in the Node project.

When we initialize a package.json file in the node project and trying to install an npm package using npm install <package-name> command, we will encounter this type of warnings in our terminal.

➜  node-app npm install express

npm WARN node-app@1.0.0 No repository field.

This warning tells us, there is no repository field in our project.

To fix this warning, add a private: true to your package.json file

{
  "name": "node-app",
  "version": "1.0.0",
  "private": "true",
}

In case, if you have a plan to publish this project as an npm package then you need to add a actual GitHub repository location (where your code lives) to the package.json file.

"repository": {
  "type": "git",
  "url" : "https://v8.googlecode.com/svn/trunk/"
}

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
130,921 students enrolled
48.5 hours of video content
View Course