domdinnes / node-flyway

Apply version control to databases from within a Node.js application.
26 stars 6 forks source link

Expecting only one executable Flyway CLI to be found. Instead found multiple executable files: flyway.cmd,README.txt,flyway #23

Open kishaningithub opened 8 months ago

kishaningithub commented 8 months ago

My DB migration script failed with the following error

$ bun run ./migrate.ts

50 |             throw new Error(`Unable to find an executable Flyway CLI in target directory: ${directory}`);
51 |         }
52 |         if (executableFiles.length > 1) {
53 |             const executableFilesWithCorrectName = executableFiles.filter(file => file.name.includes("flyway"));
54 |             if (executableFilesWithCorrectName.length > 1) {
55 |                 throw new Error(`Expecting only one executable Flyway CLI to be found. Instead found multiple executable files: ${executableFiles.map(ex => ex.name)}`);
                           ^
error: Expecting only one executable Flyway CLI to be found. Instead found multiple executable files: flyway.cmd,README.txt,flyway
      at ./node_modules/node-flyway/dist/cli/service/flyway-cli-service.js:55:23
error: script "db:migrate" exited with code 1

Migration file

This migration file is just a copy paste of the example

import { Flyway } from "node-flyway";

const flyway = new Flyway(
    {
        url:"jdbc:postgresql://localhost:5432/postgres",
        user:"postgres",
        password:"password",
        defaultSchema: "public",
        migrationLocations: ["migrations"]
    }
);

flyway.migrate().then(response => {
    if(!response.success) {
        throw new Error(`Unable to execute migrate command. Error: ${response.error?.errorCode}`);
    }
    console.log(`Migrations are successful ${response}`);
});
domdinnes commented 8 months ago

Hey @kishaningithub. Thanks for raising this. Which OS are you using?

kishaningithub commented 8 months ago

OS: Mac OS X (Mac book pro) Chip: M1 Architecture: Arm 64

ScottPierce commented 1 month ago

@domdinnes I'm also seeing this, on my M1 Mac.

error: Expecting only one executable Flyway CLI to be found. Instead found multiple executable files: flyway.cmd,README.txt,flyway
pwd
/Users/scottpierce/.node-flyway/flyway-9.0.0
ls -a 
.       conf        flyway.cmd  lib
..      drivers     jars        licenses
README.txt  flyway      jre     sql