vercel: Can't install npm dependency from git repository

In my package.json, I have a dependency that isn’t published to npmjs.com, but is publicly accessible (no SSH key/credentials required):

"myDependency": "git+https://bitbucket.org/me/myDependency"

This works fine when installing npm dependencies locally. Deployment using now fails at the installation step:

11/29 05:42 PM (10m)
npm install
11/29 05:42 PM (10m)
✓ Using "package-lock.json"
⧗ Installing 107 main dependencies…
11/29 05:42 PM (10m)

Could not find "myDependency" in the module registry!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 17
  • Comments: 27 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Looks like you forgot to regenerate your package-lock.json after updating the dependency to point to git instead of the npm registry.

You should rm -rf node_modules package-lock.json && npm install to regenerate it, then commit and push those changes. Another option would be to delete the package-lock.json and then add it to .gitignore to prevent this from happening again. But that depends on your preferences, some people like locking down the entire dependency tree.

I use git’s SSH syntax for some dependencies and it works perfectly on now.sh:

"my-dep": "git@github.com:me/my-dep.git"

I just ran into this issue, also linking in my package.json to a public repository on github.

I found a workaround though, delete package-lock.json and try now again.

Private GitHub / GitLab… repos are still not supported, only private repos through a private NPM org. (From a discussion I had on Slack with tim)

I can’t migrate to Zeit from Heroku without this capability. The way we did it via Heroku was a Heroku specific prebuild script that set the environment variables in the gitconfig: "heroku-prebuild": "git config --global url.\"https://${GITLAB_TOKEN}@gitlab.com/\".insteadOf https://gitlab.com/". I’m not sure anything like this is possible in Zeit. We don’t want our tokens stored in the package.json file either.

Thoughts?

You’re correct that now doesn’t directly rely upon commits or pushes, but it would matter if you are deploying in CI. Further, now pays attention to .gitignore. So if package-lock.json is not in your .gitignore, then this could be a problem.

If you are sure that you either ignore or regenerated package-lock.json, then you should be fine. Of course, it could have also been a fluke with the npm registry.

Now V2 supports git urls for dependencies, I just tested it.

It doesn’t support the git binary yet, but that’s a different issue: #1661 They replied there that they plan to add it soon. (https://github.com/zeit/now-cli/issues/1661#issuecomment-439176199)

They closed something like a hundred issues in the last couple of days, most with the same copy-pasted response. They’re definitely not checking whether it actually applies to v2 or not. It’s sort of understandable to want to start over. But yeah, this definitely applies to v2. And it’s frustrating to have everything closed en mass.

@leo FYI this is still happening for us, deploying to now 2.0 with now cli version 12.1.1

we tried all the different ways you can reference a git repo in a package.json, works locally with yarn, but when deploying we get error Couldn't find the binary git

Same issue here. Any plans to support private git dependencies?