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.

lerna create - Error: Command failed: git config --get user.name

See original GitHub issue

Hello, On Windows 10, I am receiving an error trying to run lerna create -

C:\dir\test-monorepo>lerna create dummy
info cli using local version of lerna
lerna notice cli v3.13.1
lerna ERR! Error: Command failed: git config --get user.name
lerna ERR!
lerna ERR!
lerna ERR!     at makeError (C:\dir\test-monorepo\node_modules\execa\index.js:174:9)
lerna ERR!     at Function.module.exports.sync (C:\dir\test-monorepo\node_modules\execa\index.js:338:15)
lerna ERR!     at Object.execSync (C:\dir\test-monorepo\node_modules\@lerna\child-process\index.js:22:16)
lerna ERR!     at CreateCommand.gitConfig (C:\dir\test-monorepo\test-monorepo\node_modules\@lerna\create\index.js:181:34)
lerna ERR!     at CreateCommand.initialize (C:\dir\test-monorepo\test-monorepo\node_modules\@lerna\create\index.js:103:46)
lerna ERR!     at Promise.resolve.then (C:\dir\test-monorepo\test-monorepo\node_modules\@lerna\command\index.js:271:24)
lerna ERR! lerna Command failed: git config --get user.name
lerna ERR! lerna
lerna ERR! lerna

However, if I run the command, I do in fact have a user.name:

C:\dir\test-monorepo>git config --get user.name
flyfishMT

Expected Behavior

I expected this command to create package “dummy” This did work for me in the windows subystem for linux bash shell.

lerna.json

{
  "name": "root",
  "private": true,
  "devDependencies": {
    "lerna": "^3.13.1"
  }
}

lerna-debug.log

0 silly argv { _: [ 'create' ],
0 silly argv   lernaVersion: '3.13.1',
0 silly argv   '$0':
0 silly argv    '..\\..\\..\\AppData\\Roaming\\npm\\node_modules\\lerna\\cli.js',
0 silly argv   name: 'dummy' }
1 notice cli v3.13.1
2 verbose rootPath C:\dir\test-monorepo
3 error Error: Command failed: git config --get user.name
3 error
3 error
3 error     at makeError (C:\dir\test-monorepo\node_modules\execa\index.js:174:9)
3 error     at Function.module.exports.sync (C:\dir\test-monorepo\node_modules\execa\index.js:338:15)
3 error     at Object.execSync (C:\dir\test-monorepo\node_modules\@lerna\child-process\index.js:22:16)
3 error     at CreateCommand.gitConfig (C:\dir\test-monorepo\node_modules\@lerna\create\index.js:181:34)
3 error     at CreateCommand.initialize (C:\dir\test-monorepo\node_modules\@lerna\create\index.js:103:46)
3 error     at Promise.resolve.then (C:\dir\test-monorepo\node_modules\@lerna\command\index.js:271:24)

Your Environment

Executable Version
lerna --version 3.13.1
npm --version 6.4.1
node --version v10.15.1
OS Version
Windows 10 1803

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
gchariscommented, May 24, 2019

@flyfishMT

Solved it by setting user.name and user.email locally to the project.

git config user.name flyfishMT git config user.email <your-email>

If that doesn’t work for you, you could tweak the internal packages of lerna. The internal implementation of lerna cli makes use of the execa package. The command you should look for is inside @lerna\child-process\index.js. Search for execSync and maybe use a try catch statement to get access to the full error.

That is if you still have the above error which I doubt.

7reactions
evocateurcommented, Jun 2, 2019

I would recommend using a POSIX shell, git on anything Windows has been garbage for eons. I don’t have time to debug Windows’ pitiful excuse for a (non-WSL) shell.

WSL sounds like it fits the bill.

Read more comments on GitHub >

github_iconTop Results From Across the Web

lerna create - Error: Command failed: git config --get user. ...
Hello, On Windows 10, I am receiving an error trying to run lerna create - C:\dir\test-monorepo>lerna create dummy info cli using local ...
Read more >
git config - Git configuration user.name doesn't work
git config --global user.name = "My Name". the command interprets the = character as the string value passed to the user.name key, and...
Read more >
Troubleshooting
Troubleshooting. This document contains solutions for certain issues our users encountered in the past while using Lerna.
Read more >
How to Fix the “fatal: not a git repository” Error
Check that you correctly created the repo. If the directory doesn't contain a .git repo, use git init to properly initialize the repo...
Read more >
Husky - Git hooks
Try to make a commit git commit -m "Keep calm and commit". If npm test command fails, your commit will be automatically aborted....
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