streetsidesoftware / cspell

A Spell Checker for Code!

Home Page:https://cspell.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug]: Failed to read config file of unexisting folder

Erythros opened this issue · comments

Info

Kind of Issue

  • runtime - command-line tools
  • building / compiling
  • security
  • change in behavior
  • crash / error

Which Tool or library

  • cspell -- the command-line spelling tool
  • cspell/eslint-plugin -- the plugin for ESLint
  • cspell-tools -- used for building dictionary files
  • cspell-lib -- library that does the actual spell checking.
  • cspell-trie -- tool for working with trie files.

Which Version

Version: 7.3.8

Issue with supporting library?

  • No
  • cspell-glob -- library for matching glob patterns
  • cspell-io -- thin file i/o library
  • cspell-trie-lib - trie lib
  • cspell-trie2-lib - trie lib alternate format

OS:

  • Macos
  • Linux
  • Windows
  • Other

Bug Description

Describe the bug

I had a basic Typerscript starter with CSpell and lint-staged. The 2 commands I used

"scripts": {
    "spell-check": "cspell --no-progress",
}
"lint-staged": {
        "*.{html,js,json,md,scss,ts,vue}": "cspell --no-must-find-files"
}

All was good until I played a little bit around with dict-lorem-ipsum. Decided to remove it. Then proceeded to remove my repo, change the folder structure and reclone.

Since then, I cannot run cspell anymore on first few tries.

I am constantly running into

Configuration Error: Failed to read config file: "C:\my-prototype\node_modules\@cspell\dict-lorem-ipsum\cspell-ext.json"

The current workind directory is not that anymore. And my-prototype project doesn't exist anymore. Yet, I get this error every time I run cspell or when I try to commit (because of lint-staged and githooks).

I tried installing all the libraries again, and removing them.
I tried installing cspell and the dic globally. Then I removed them

Nothing seems to work. After a few tries or after I do an npm install --save-dev cspell and uninstall it, it usually works. Until I close the IDE and open it again.

I run out of ideas.
To Reproduce

I don't know how to reproduce it. I don't even understand what is happening.

Additional context

I don't have anything else.

@Erythros,

It sounds like the global config is referring to the dictionary that has been removed.

Please try:

cspell link list

To list the globally linked dictionaries.

cspell link remove lorem-ipsum

Can be used to remove the lorem-ipsum reference.

@Jason3S thanks for getting back so quick to me.
I have already tried that.

The problem is that the lorem-ipsum doesn't have... a "package" name anymore. Here's what I mean

image

Since the name column is empty, I cannot do cspell link remove. I tried. There's no ID, no package.... just a weird file name.

One more quick update.

I managed to clear the list with cspell link remove {file_path}.

Now cspell link list returns an empty list.

image

However, any cspell command I run now throws

Configuration Error: Failed to read config file: "D:\{pwd}\node_modules\@cspell\cspell-bundled-dicts\@cspell\dict-lorem-ipsum\cspell-ext.json"

Where pwd is the current working directory. Doesn't matter the project folder, I always get this.

Can't understand what's going on.

@Erythros,

It is stored in a global config file.

I'm not on a windows machine at the moment, but I believe it is stored in your user directory under .config/configstore/cspell.json.

Just delete the file or edit it and remove the lorem-ipsum entry.

One more quick update.

I managed to clear the list with cspell link remove {file_path}.

Now cspell link list returns an empty list.

image

However, any cspell command I run now throws

Configuration Error: Failed to read config file: "D:\{pwd}\node_modules\@cspell\cspell-bundled-dicts\@cspell\dict-lorem-ipsum\cspell-ext.json"

Where pwd is the current working directory. Doesn't matter the project folder, I always get this.

Can't understand what's going on.

This is because cspell includes lorem-ipsum by default. By removing the global package, it cannot find it when running the global cspell command line.

  • npm uninstall -g cspell followed by npm install -g cspell should fix it.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.