Try npm install <ghusername>/<repoName>
, where <ghUsername>
is your GitHub username (without the @
) and <repoName>
is the name of the repository. That should correctly install it. You will most likely want to use the --save
or --save-dev
flag with the install command to save dependency in your package.json
.
If that isn’t working correctly, check the contents of your .npmignore
file.
Don’t panic if the install command takes a long time; installing from a git repository is slower than installing from the npm registry.
Edit:
Your problem is that in your case, dist/
is not committed to the repo (since it is in the .gitignore
). That is where the actual code lives. dist/
is built from the files in src/
before the package is published to the npm registry, but dist/
is never committed to the repo.
It’s ugly, but in this case you will have to remove dist/
from the .gitignore
and then run:
npm run build
git add .
git commit
git push
(Ensure that you have run npm install
first)
You then should be able to install from github.
There might be another way to do this using a prepare
script, but I’m not sure if that’s possible; I’ve never tried it. Edit: Cameron Tacklind has written an excellent answer detailing how to do this: https://stackoverflow.com/a/57829251/7127751