graphlab-fr / cosma

Cosma is a document graph visualization tool. It modelizes interlinked Markdown files and renders them as an interactive network in a web interface.
https://cosma.arthurperret.fr
GNU General Public License v3.0
125 stars 4 forks source link

[Bug] cli failing to create new user data directory #106

Closed Jonathan-Zollinger closed 6 months ago

Jonathan-Zollinger commented 9 months ago

What version of Cosma are you using?

2.4.0

On which operating system(s) did you observe the bug?

What version of the operating system are you on?

Windows 11 Home (22H2 22621.3007) & Fedora 39 workstation

Actions leading to the bug

  1. install cosma (no upgrade)
  2. call cosma --create-user-data-dir
  3. error output is printed to the screen (see bug description)

Bug description

attempting to create a user data directory produces this error and fails to produce the directory needed.

$_> cosma --create-user-data-dir
Warn. No default or local config file to use. Cosma runs with factory config. Use "cosma config --help" for more info about create config file.
node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module '../models/config-cli'
Require stack:
- C:\Users\jonat\AppData\Roaming\npm\node_modules\@graphlab-fr\cosma\controllers\user-data-dir.js
- C:\Users\jonat\AppData\Roaming\npm\node_modules\@graphlab-fr\cosma\app.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Module.require (node:internal/modules/cjs/loader:1234:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (C:\Users\jonat\AppData\Roaming\npm\node_modules\@graphlab-fr\cosma\controllers\user-data-dir.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1375:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1434:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1234:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\jonat\\AppData\\Roaming\\npm\\node_modules\\@graphlab-fr\\cosma\\controllers\\user-data-dir.js',
    'C:\\Users\\jonat\\AppData\\Roaming\\npm\\node_modules\\@graphlab-fr\\cosma\\app.js'
  ]
}

Additional information

I've replicated this issue on both a fedora machine and a windows machine.

I've added software versions between the two setups below.

software fedora windows
npm 10.2.3 10.2.4
node 20.10.0 21.5.0
infologie commented 9 months ago

@Jonathan-Zollinger Thanks for opening an issue. I can reproduce the bug on macOS. I also have the following bugs:

Warn. No default or local config file to use. Cosma runs with factory config. Use "cosma config --help" for more info about create config file.
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '../models/config-cli'
Require stack:
- /opt/homebrew/lib/node_modules/@graphlab-fr/cosma/controllers/user-data-dir.js
- /opt/homebrew/lib/node_modules/@graphlab-fr/cosma/app.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at Object.<anonymous> (/opt/homebrew/lib/node_modules/@graphlab-fr/cosma/controllers/user-data-dir.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/homebrew/lib/node_modules/@graphlab-fr/cosma/controllers/user-data-dir.js',
    '/opt/homebrew/lib/node_modules/@graphlab-fr/cosma/app.js'
  ]
}

Node.js v19.8.1

Pinging @Myllaume. I think this is an issue with detecting the absence/presence of the defaults file.

Until the bug is fixed, follow these steps:

This does not fix the error with cosma --create-user-data-dir but it makes the warning about default config go away.