[Bug] cli failing to create new user data directory
Jonathan-Zollinger opened this issue · comments
What version of Cosma are you using?
2.4.0
On which operating system(s) did you observe the bug?
- macOS
- Windows
- Linux
What version of the operating system are you on?
Windows 11 Home (22H2 22621.3007) & Fedora 39 workstation
Actions leading to the bug
- install cosma (no upgrade)
- call
cosma --create-user-data-dir
- 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 |
@Jonathan-Zollinger Thanks for opening an issue. I can reproduce the bug on macOS. I also have the following bugs:
- Using
cosma --help
without having created a user data directory produces a similar warning:
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.
- If I create the user data directory manually, using
cosma --create-user-data-dir
should produce a message about the directory being already there, but instead I get an error message that is similar to yours:
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:
- Create a user data directory manually. On Linux, it should be something like
$HOME/.config/cosma-cli
or$HOME/.local/share/cosma-cli
. On macOS,~/Library/Application Support/cosma-cli
. - Add a
defaults.yml
configuration file manually to your user data directory. It can be empty.
This does not fix the error with cosma --create-user-data-dir
but it makes the warning about default config go away.