firebase / genkit

An open source framework for building AI-powered apps with familiar code-centric patterns. Genkit makes it easy to integrate, test, and deploy sophisticated AI features to Firebase or Google Cloud.
Apache License 2.0
590 stars 68 forks source link

[JS] Build failure with out sample flow #250

Open hemanth opened 3 months ago

hemanth commented 3 months ago
❯ genkit init
? Select the deployment platform: 
  Firebase 
? Select the deployment platform: Node.js
? Select the model provider: 
  Google AI 
? Select the model provider: Ollama (e.g. Gemma)
Installing packages...

added 368 packages, and audited 369 packages in 1m

found 0 vulnerabilities

added 1 package, and audited 370 packages in 18s

found 0 vulnerabilities
Updating tsconfig.json...
? Would you like to update your package.json with suggested settings? 
  Set if unset 
? Would you like to update your package.json with suggested settings? Overwrite

Updating package.json...
? Would you like to generate a sample flow? (Y/n) n

? Would you like to generate a sample flow? No
If you don't have Ollama already installed and configured, refer to https://developers.google.com/genkit/plugins/ollama

Genkit successfully initialized.
/tmp/foo is 📦 v1.0.0 via  v20.5.1 took 4m30s 
❯ ls
node_modules        package.json        tsconfig.json
package-lock.json   src
/tmp/foo is 📦 v1.0.0 via  v20.5.1 
❯ npm run
Lifecycle scripts included in @paypalcorp/foo@1.0.0:
  test
    echo "Error: no test specified" && exit 1
  start
    node lib/index.js

available via `npm run-script`:
  build
    tsc
  build:watch
    tsc --watch
/tmp/foo is 📦 v1.0.0 via  v20.5.1 
❯ genkit start

> @paypalcorp/foo@1.0.0 build
> tsc

error TS18003: No inputs were found in config file '/private/tmp/foo/tsconfig.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["lib"]'.

Found 1 error.

node:internal/errors:865
  const err = new Error(message);
              ^

Error: Command failed: npm run build
    at checkExecSyncError (node:child_process:887:11)
    at execSync (node:child_process:959:15)
    at Runner.build (/Users/hemanth/.nvm/versions/node/v20.5.1/lib/node_modules/genkit/node_modules/@genkit-ai/tools-common/lib/cjs/runner/runner.js:224:42)
    at Runner.start (/Users/hemanth/.nvm/versions/node/v20.5.1/lib/node_modules/genkit/node_modules/@genkit-ai/tools-common/lib/cjs/runner/runner.js:72:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.<anonymous> (/Users/hemanth/.nvm/versions/node/v20.5.1/lib/node_modules/genkit/dist/commands/start.js:55:9)
    at async Command.parseAsync (/Users/hemanth/.nvm/versions/node/v20.5.1/lib/node_modules/genkit/node_modules/commander/lib/command.js:936:5)
    at async startCLI (/Users/hemanth/.nvm/versions/node/v20.5.1/lib/node_modules/genkit/dist/cli.js:66:5)
    at async /Users/hemanth/.nvm/versions/node/v20.5.1/lib/node_modules/genkit/dist/bin/genkit.js:6:5 {
  status: 2,
  signal: null,
  output: [ null, null, null ],
  pid: 26318,
  stdout: null,
  stderr: null
}

Node.js v20.5.1
Would you like to generate a sample flow? No

^ would result in this error.

cabljac commented 1 month ago

Hi, this doesn't seem like a bug to me - genkit init will product an empty project without any sample flow (without and index.tswith sample code) and thengenkit startwill try to build your genkit project (withtsc`) which will fail if you haven't written any code.

What would the desired behaviour here be?

cabljac commented 1 month ago

The resolution here would be to provide a clearer error i think.