The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
npm install unlisted repository with scoped name
If you create a repository and give it a scoped name like @myname/my-unlisted-project then try to add it using npm install https://[git path].git, you get an error about the package.json file being missing. Shouldn’t this work?
Make sure that you can actually clone the repo using that URL and that you have actually published the package.json there, if it’s a private repo, make sure that you have configured your GitHub token
I had not published the package, but I didn’t think that was a prerequisite. I thought you could reference a package from its git location without publishing it.
For example… I make a package.json and index.js that console logs hello world.
In another directory I run
npm install https://github.com/ryanburnette/hello-world
That will work…
But it won’t work if the package.json’s name attribute is scoped.
Sorry, i was not exactly clear.
Have you double checked that you have added the
package.json to the repo?
Here is an example:
m@vigilant /tmp/bar-package % npm i https://github.com/coderbyheart/foo-package npm notice CANARY npmc is experimental software. If you find an issue, please file it in the main npm repository, and call out that you were using npmc. npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN firstname.lastname@example.org No description npm WARN email@example.com No repository field. + @firstname.lastname@example.org added 1 package and audited 1 package in 3.966s found 0 vulnerabilities
This is the repo: https://github.com/coderbyheart/foo-package
Yes I had a package.json in the repo. I see that npm install works on the unlisted package you mentioned. There must be something else amiss. There were definitely package.json files in both the install directory and the unlisted package.