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

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

Closed
2 of 3 tasks
Jonathan-Zollinger opened this issue Feb 6, 2024 · 1 comment · Fixed by #111
Closed
2 of 3 tasks

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

Jonathan-Zollinger opened this issue Feb 6, 2024 · 1 comment · Fixed by #111
Assignees
Labels
bug Something isn't working

Comments

@Jonathan-Zollinger
Copy link

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

  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
@Jonathan-Zollinger Jonathan-Zollinger added the bug Something isn't working label Feb 6, 2024
@infologie
Copy link
Contributor

infologie commented Feb 7, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants