Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] unable to find configuration file (using it in non JS Project) #234

Open
lamyergeier opened this issue Apr 27, 2024 · 1 comment

Comments

@lamyergeier
Copy link

lamyergeier commented Apr 27, 2024

Install

$ npm i -g commitizen cz-customizable

$ file /home/lamy/opt/.nvm/versions/node/v20.7.0/lib/node_modules/cz-customizable/
/home/lamy/opt/.nvm/versions/node/v20.7.0/lib/node_modules/cz-customizable/: directory

$ command cat ~/.czrc 
{"path":"/mnt/Data/opt/.nvm/versions/node/v20.7.0/lib/node_modules/cz-customizable"}

My repository

Note: I have added cz-config.js to repository head

$ la
total 24K
755 drwxr-xr-x. 7 lamy lamy 4.0K 2024-04-28 01:21 .git
644 -rw-r--r--. 1 lamy lamy   17 2024-04-27 00:33 .gitignore
644 -rw-r--r--. 1 lamy lamy 2.3K 2024-04-28 01:19 Podcast.json
644 -rw-r--r--. 1 lamy lamy   57 2024-04-27 23:46 Podcast_tag.txt
644 -rw-r--r--. 1 lamy lamy 2.5K 2024-04-28 01:17 cz-config.js

Error

$ cz
[email protected], [email protected]

Unable to find a configuration file. Please refer to documentation to learn how to set up: https://github.com/leonardoanalista/cz-customizable#steps "
Cannot read properties of null (reading 'subjectLimit')
$ cz-customizable
cz-customizable standalone version
Unable to find a configuration file. Please refer to documentation to learn how to set up: https://github.com/leonardoanalista/cz-customizable#steps "
/mnt/Data/opt/.nvm/versions/node/v20.7.0/lib/node_modules/cz-customizable/index.js:16
    config.subjectLimit = config.subjectLimit || 100;
                                 ^

TypeError: Cannot read properties of null (reading 'subjectLimit')
    at Object.prompter (/mnt/Data/opt/.nvm/versions/node/v20.7.0/lib/node_modules/cz-customizable/index.js:16:34)
    at Object.<anonymous> (/mnt/Data/opt/.nvm/versions/node/v20.7.0/lib/node_modules/cz-customizable/standalone.js:19:5)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.7.0

Note

I get the same error when I put cz-config.js inside ${HOME} instead of the repository (as above).

@lamyergeier lamyergeier changed the title Unable to find configuration file (using it in non JS Project) [Error] unable to find configuration file (using it in non JS Project) Apr 27, 2024
@pokeyaro
Copy link

Maybe it's not “subjectLimit“ problem, you can try the following steps.

  1. If the content starts with module.exports = { ..., it is recommended to change cz-config.js to .cjs
  2. In addition, configuration items can be changed in package.json:
{
  ...,
  "config": {
    "commitizen": {
      "path": "node_modules/cz-customizable"
    },
    "cz-customizable": {
      "config": "your-path/cz-config.cjs"
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants