dword-design / nuxt-mail

Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Other
239 stars 18 forks source link

Installation from npm still fails #94

Closed feritarou closed 2 years ago

feritarou commented 2 years ago

Continuing the discussion in the closed Issue #15, nuxt-mail fails to install its dependencies for me in production CI, but in my case it is not related to a missing git binary. This is what I get:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/dword-design/endent.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

I am using Nuxt.js 2.15.8 and deploying to a self-hosted Dokku environment.

dword-design commented 2 years ago

@feritarou I did some research on this and I think the problem is that the CI system does not now the github.com host. Locally, you usually get a prompt where you can accept the host and then it is added to the ~/.ssh/known_hosts file. On CI systems, you are not asked the prompt. Theoretically, you can add the host to the known_hosts file and then it should work (see also this answer on Stack Overflow). Which CI system are you using?

The question now is, if it makes more sense to adjust the CI process, or if you should avoid fork dependencies in package.json in general. I do not have a clear opinion on this and I'm open to suggestions/resources.

References:

davidsandoz commented 2 years ago

I got almost the same error. Maybe it's even the same, but just expressed differently because of a different npm version.

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/dword-design/endent.git
npm ERR! 
npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

This happens within a GitHub action.

A few workarounds are provided in https://github.com/actions/setup-node/issues/214

An easy one being to replace git+ssh:// with git+https:// in package-lock.json.

dword-design commented 2 years ago

@davidsandoz Thanks for the link! I could reproduce the issue and commented on it in the linked issue. I think the only reasonable fix is to replace the forks with scoped packages. It's far from ideal because you cannot make out which scoped package comes from a fork and which is really a scoped production package, but yeah that's how it is.

Let me know if that makes sense, then I can do the replacements, no big deal.

davidsandoz commented 2 years ago

@dword-design I agree with you regarding the reasonable fix. The workaround I applied works, but it doesn't seem like a proper solution to have to update this manually in the package-lock file.

dword-design commented 2 years ago

@davidsandoz Should work after npm update. Feel free to reopen if there are issues.

davidsandoz commented 2 years ago

Thanks, @dword-design! Works well now :+1: