Reputation: 432
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
Upvotes: 28
Views: 41479
Reputation: 336
npm pkg fix should fix your package.json issues automatically.
Add your github repo to your NPM package like this:
"repository": {
"type": "git",
"url": "git+https://github.com/your_username/repo_name.git"
}
From the docs:
npm pkg fix
will auto corrects common errors in your package.json
. npm already does this during publish, which leads to subtle (mostly harmless) differences between the contents of your package.json
file and the manifest that npm uses during installation.
Upvotes: 2
Reputation: 10936
Just run either below command:
npm install --save https://github.com/sonyzach/usfm-validator
or:
yarn add https://github.com/sonyzach/usfm-validator
Upvotes: 12
Reputation: 4754
you can add to dependencies block in your package.json file like
"dependencies": {
"usfm-validator": "github.com/sonyzach/usfm-validator"
}
Upvotes: 1
Reputation: 1847
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
Upvotes: 45