question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`npm init vite-plugin-ssr@latest` logs "fatal" git errors.

See original GitHub issue

Description

When scaffolding a new vite-plugin-ssr project with npm init vite-plugin-ssr@latest, the following git errors are logged in the command’s output:

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
error: No such remote 'origin'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

This doesn’t seem to cause any actual issue with git initialization or the first commit. Rather, this seems to be a normal git behavior when committing for the first time in a fresh repository. The error logs on the first commit but then won’t log again on subsequent commits.

However, this behavior is a little noisy in the scaffolding logs, and made me initially wonder if something went wrong with the operation.

As a solution, we could simply prevent the log from making it to the user by passing { stdio: 'ignore' } in the git-related execSync options. As far as I can tell, create-react-app uses the same approach to prevent these errors from making it to users.

I’m not sure of another option offhand; there might be something better. If ignoring the output here sounds like an OK path forward to you as well though, I’d be happy to submit a PR with that change.

Error Stack

Included in description

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
brilloutcommented, Oct 18, 2022

Ok I see. Yes, PR welcome! Good idea.

0reactions
brilloutcommented, Oct 25, 2022

Done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common errors | npm Docs
You are trying to install on a drive that either has no space, or has no permission to write. Free some disk space...
Read more >
npm install giving error while accessing GIT url - Stack Overflow
I just used the following command and the issue got resolved. git config --global url."https://".insteadOf git://.
Read more >
[BUG] Failed to install npm package from git in docker since v6 ...
A complete log of this run can be found in: npm ERR! ... /root/.npm/_cacache/tmp/git-clone-c9699b7f npm ERR! fatal: could not create leading ...
Read more >
Can't Read From Remote Git Repository During npm install
You may encounter this error when installing npm. npm ERR! git clone ... fatal: Could not read from remote repository. npm ERR! git...
Read more >
how to fix the npm install fails with 'An unknown git error ...
I was having a similar issue, although after the git command error it said it couldn't write or create a tmp directory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found