commitizen / commitizen/cz-cli

path resolve failed on MSYS2+zsh environment

Open
#823 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.5k
Forks
566
Avg merge
8h 16m
Merged PRs (30d)
1

Description

OS Version: Windows 10 ver 1909 (18363.1500)
node version: v14.10.0
npm version: v6.14.8

In my situation, I installed msys2 & zsh on Windows, and I use zsh as my shell. My Node.JS is Windows version.

When I use commitizen, it fails in resolve the path for `cz-conventional-changelog`.

In my `package.json`
```json
{
...
"scripts": {
"commit": "git-cz"
},
"devDependencies": {
"commitizen": "^4.2.3"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
...
}
```

When I use `npm run commit`, it gives:
```bash
$ npm run commit

> update-vue2-vite@1.0.0 commit E:\Projects\Github\boxsnake\update-vue2-vite
> git-cz

Could not resolve E:\e\Projects\Github\boxsnake\update-vue2-vite\node_modules\cz-conventional-changelog. Cannot find module 'E:\e\Projects\Github\boxsnake\update-vue2-vite\node_modules\cz-conventional-changelog'
Require stack:
- E:\Projects\Github\boxsnake\update-vue2-vite\node_modules\_commitizen@4.2.3@commitizen\dist\commitizen\adapter.js
- E:\Projects\Github\boxsnake\update-vue2-vite\node_modules\_commitizen@4.2.3@commitizen\dist\commitizen.js
- E:\Projects\Github\boxsnake\update-vue2-vite\node_modules\_commitizen@4.2.3@commitizen\dist\cli\git-cz.js
- E:\Projects\Github\boxsnake\update-vue2-vite\node_modules\_commitizen@4.2.3@commitizen\bin\git-cz.js
- E:\Projects\Github\boxsnake\update-vue2-vite\node_modules\_commitizen@4.2.3@commitizen\bin\git-cz
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! update-vue2-vite@1.0.0 commit: `git-cz`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the update-vue2-vite@1.0.0 commit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Programs\nodejs\global\cache\_logs\2021-04-25T16_03_44_621Z-debug.log
```

PS. When I use `node -e 'console.log(process.cwd())'` in zsh environment, it gives Windows formatted path:
```bash
$ node -e 'console.log(process.cwd());'
E:\Projects\Github\boxsnake\update-vue2-vite
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.