npm install unlisted repository with scoped name

(Ryan Burnette) #1

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?

(Markus Tacker) #2

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

(Ryan Burnette) #3

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

That will work…

But it won’t work if the package.json’s name attribute is scoped.

(Markus Tacker) #4

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
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 bar-package@1.0.0 No description
npm WARN bar-package@1.0.0 No repository field.

+ @foo/package@1.0.0
added 1 package and audited 1 package in 3.966s
found 0 vulnerabilities 

This is the repo:

(Ryan Burnette) #5

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.

(system) #6

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.