Repository: promptfoo/promptfoo
Issue: Promptfoo doesn't start without installing @ibm-cloud/watsonx-ai
Root cause: Validation Gap

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
1. `mkdir tmp && cd tmp`
2. `yarn add promptfoo`
3. `yarn promptfoo`
4. See error

```
$ ./tmp/node_modules/.bin/promptfoo
node:internal/modules/cjs/loader:1078
  throw err;
  ^

node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module '@ibm-cloud/watsonx-ai'
Require stack:
- ./tmp/node_modules/promptfoo/dist/src/providers/watsonx.js
- ./tmp/node_modules/promptfoo/dist/src/providers.js
- ./tmp/node_modules/promptfoo/dist/src/matchers.js
- ./tmp/node_modules/promptfoo/dist/src/assertions.js
- ./tmp/node_modules/promptfoo/dist/src/evaluator.js
- ./tmp/node_modules/promptfoo/dist/src/commands/eval.js
- ./tmp/node_modules/promptfoo/dist/src/main.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:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (./tmp/node_modules/promptfoo/dist/src/providers/watsonx.js:9:22)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427: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:1231:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    './tmp/node_modules/promptfoo/dist/src/providers/watsonx.js',
    './tmp/node_modules/promptfoo/dist/src/providers.js',
    './tmp/node_modules/promptfoo/dist/src/matchers.js',
    './tmp/node_modules/promptfoo/dist/src/assertions.js',
    './tmp/node_modules/promptfoo/dist/src/evaluator.js',
    './tmp/node_modules/promptfoo/dist/src/commands/eval.js',
    './tmp/node_modules/promptfoo/dist/src/main.js'
  ]
}

Node.js v20.12.2
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

**Expected behavior**
Promptfoo shows CLI help info

- Promptfoo version: 0.93.3

**Additional context**
A workaround is to explicitly install `@ibm-cloud/watsonx-ai`

Hi @tomquist, thanks for reporting this! We’ve fixed the issue by lazy-loading the @ibm-cloud/watsonx-ai dependency in [#1977](https://github.com/promptfoo/promptfoo/pull/1977). Please update to version [0.94.0](https://github.com/promptfoo/promptfoo/releases/tag/0.94.0) to resolve the issue.

Let us know if you run into any other problems!

@mldangelo Given that this is not the first time such an issue happened (see #1847), would it make sense to add a small CI regression test running the above steps to reproduce?

Hi @tomquist, yes, I completely agree. I’m planning to add a CI regression test to catch issues like this in the future (where we build promptfoo, delete node modules, and try to run an eval. Thanks for the suggestion. Apologies for the inconvenience, and thanks again for your feedback and patience.