cz-cli icon indicating copy to clipboard operation
cz-cli copied to clipboard

Git bash on windows: cannot read property 'get' of undefined

Open MartinMuzatko opened this issue 8 years ago • 4 comments

Currently I get this error when running git-cz on a windows system:

Martin Muzatko@martin MINGW64 ~/dev/bitbucket/sicon (docker)
$ npx git-cz
Error: EPERM: operation not permitted, mkdir 'C:\Users\Martin'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:224:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:262:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
    at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
    at FSReqWrap.oncomplete (fs.js:170:21)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at process.emit (events.js:180:13)
    at process._fatalException (bootstrap_node.js:431:27)
Install for prefix@latest failed with code 7
C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\bin\git-cz.js
The system cannot find the path specified.
×  fatal                        Error: Could not find Git root folder.
    at createState (C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\dist\cli.js:202:11)
    at main (C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\dist\cli.js:105:19)
    at Object.2../createState (C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\dist\cli.js:158:1)
    at o (C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\dist\cli.js:1:327)
    at r (C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\dist\cli.js:1:493)
    at Object.<anonymous> (C:\Users\Martin Muzatko\AppData\Roaming\npm\node_modules\git-cz\dist\cli.js:1:522)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)

MartinMuzatko avatar Aug 31 '18 14:08 MartinMuzatko

the problem is that the path is cut off at the space. the path should be "Martin Muzatko" instead

MartinMuzatko avatar Aug 31 '18 14:08 MartinMuzatko

Getting the same issue here, but there is no space in our paths, this is running on windows with gitbash as the shell, WSL on the other hand is fine.

$ git-cz
The system cannot find the path specified.
×  fatal     Error: Could not find Git root folder.
    at createState (C:\work\GITHUBPROJECT\node_modules\git-cz\dist\cli.js:202:11)
    at main (C:\work\GITHUBPROJECT\node_modules\git-cz\dist\cli.js:105:19)
    at Object.2../createState (C:\work\GITHUBPROJECT\node_modules\git-cz\dist\cli.js:158:1)
    at o (C:\work\GITHUBPROJECT\node_modules\git-cz\dist\cli.js:1:327)
    at r (C:\work\GITHUBPROJECT\node_modules\git-cz\dist\cli.js:1:493)
    at Object.<anonymous> (C:\work\GITHUBPROJECT\node_modules\git-cz\dist\cli.js:1:522)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)

dmcclurealinta avatar Dec 20 '18 04:12 dmcclurealinta

I don't have this environment available to me but would love a PR if anyone has time to look into it.

jimthedev avatar Jul 17 '19 22:07 jimthedev

May be below steps help you out for the issue... clean cache with npm cache clean --force install the latest version of npm globally as admin:

npm install -g npm@latest --force clean cache with

npm cache clean --force Try to install your component once again.

After the above steps, you follow. Please fire the below commands. commitizen init cz-conventional-changelog --save-dev --save-exact

bechar-ce avatar Oct 06 '19 18:10 bechar-ce