gramma icon indicating copy to clipboard operation
gramma copied to clipboard

ERR_INVALID_ARG_TYPE when trying to add to local dictionary

Open kript opened this issue 2 years ago • 1 comments

Describe the bug

When running gramma against a markdown file using en-GB language, a new word is found. Attempting to add it to the dictionary causes an npm error. New files can be created in users home directory and in current working directory.

To Reproduce

gramma check -m -l "en-GB" Lessons.md
Language: English (GB)
Resolved: 0 | Pending: 12
---------------------------------

Rule: typos
Explanation: Possible spelling mistake found.

Context: # Lessons  1. [What is iRODS?](https://github.com/metadata-school/In...
Suggested fix: 1) rods  2) irons  3) iPods  4) prods

---------------------------------
? What do you want to do?
Enter: default (1)
1-4: choose fix
0: custom fix
i: ignore
l: add to local dictionary
g: add to global dictionary
n: next
 › l
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at Object.openSync (node:fs:577:10)
    at Object.openSync (pkg/prelude/bootstrap.js:739:32)
    at Object.writeFileSync (node:fs:2153:35)
    at configure (/snapshot/gramma/src/actions/configure.js:87:6)
    at checkInteractively (/snapshot/gramma/src/actions/checkInteractively.js:50:7)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async check (/snapshot/gramma/src/commands/check.js:32:31) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Expected behavior

New word is added to the local dictionary.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04 LTS run in WSL.
  • Gramma Version: 1.6.0

kript avatar Jun 07 '22 07:06 kript

I have just discovered that this occurs when gramma init has not been run first.

kript avatar Jun 26 '22 21:06 kript