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

ESM Import: no such file or directory, open 'lib/migrations/migrate/stub/mjs.stub' #4404

Closed
tomhoad opened this issue Mar 29, 2021 · 3 comments · Fixed by #4631
Closed

ESM Import: no such file or directory, open 'lib/migrations/migrate/stub/mjs.stub' #4404

tomhoad opened this issue Mar 29, 2021 · 3 comments · Fixed by #4631

Comments

@tomhoad
Copy link

tomhoad commented Mar 29, 2021

Environment

Knex version: 0.95.4
Database + version: Postgres 13
OS: Mac OS 10.14.6

Bug

  1. I have a knexfile.mjs:
const knex = {
  local: {
    client: "pg",
    connection: {
      host: config.dbUrl,
      database: config.dbName,
      user: config.dbUser,
      password: config.dbPass,
    },
    pool: {
      min: 2,
      max: 10,
    },
    migrations: {
      tableName: "knex_migrations",
      extension: "mjs",
      loadExtensions: [".mjs"],
    },
  },
}

I run:

./node_modules/.bin/knex --esm migrate:make create_users_table --env local --knexfile knexfile.mjs
  1. Error message:
Using environment: local
Error: ENOENT: no such file or directory, open '/.../node_modules/knex/lib/migrations/migrate/stub/mjs.stub'
@tomhoad tomhoad changed the title ESM Import Issue ESM Import: no such file or directory, open '/.../node_modules/knex/lib/migrations/migrate/stub/mjs.stub' Mar 29, 2021
@tomhoad tomhoad changed the title ESM Import: no such file or directory, open '/.../node_modules/knex/lib/migrations/migrate/stub/mjs.stub' ESM Import: no such file or directory, open 'lib/migrations/migrate/stub/mjs.stub' Mar 29, 2021
@vladshcherbin
Copy link

Same error, thrown if migrations.extension is set to mjs

@tlhunter
Copy link
Contributor

I get the same error with:

  • knex@0.21.21
  • node@16.3.0

@kibertoad
Copy link
Collaborator

Released in 0.95.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants