23

I have an app where I didn't add its repository in package.json while doing npm init.

Now I want to add repo in the package.json file, but couldn't find helpful solutions for me.

Also, I found repository url's ending like this .git but my repo address is simply this https://github.com/sonyzach/usfm-validator

  1. How can I add my repo url in my package.json?
  2. Which format need to add in package.json?
KyleMit
  • 30,350
  • 66
  • 462
  • 664
zachi
  • 374
  • 2
  • 3
  • 12
  • **See Also**: [npm WARN package.json: No repository field](https://stackoverflow.com/q/16827858/1366033) – KyleMit Nov 27 '21 at 14:28

3 Answers3

41

You can just open the package.json file with any editor and add the following in the main object

"repository": {
    "type": "git",
    "url": "https://github.com/sonyzach/usfm-validator.git"
},

also I think you should add the .git version

Ivan Mladenov
  • 1,787
  • 12
  • 16
10

Just run either below command:

npm install --save https://github.com/sonyzach/usfm-validator

or:

yarn add https://github.com/sonyzach/usfm-validator
DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127
Long Nguyen
  • 9,898
  • 5
  • 53
  • 52
1

you can add to dependencies block in your package.json file like

  "dependencies": {
    "usfm-validator": "github.com/sonyzach/usfm-validator"
  }
user889030
  • 4,353
  • 3
  • 48
  • 51