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
To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.
You can add dependencies to a package. json file from the command line or by manually editing the package.
The repository property of a package. json is an array that defines where the source code for the module lives. Typically, for open source projects, this would be a public GitHub repo, with the repository array noting that the type of version control is git , and the URL of the repo itself.
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
Just run below command:
npm install --save https://github.com/sonyzach/usfm-validator
or
yarn add https://github.com/sonyzach/usfm-validator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With