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]: ERR_PACKAGE_PATH_NOT_EXPORTED when generating migration #2254

Open
FrancoRATOVOSON opened this issue May 4, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@FrancoRATOVOSON
Copy link

What version of drizzle-orm are you using?

0.30.7

What version of drizzle-kit are you using?

0.20.14

Describe the Bug

Everytime I try to generate migration files, drizzle kit generate this error :

drizzle-kit: v0.20.16
drizzle-orm: v0.30.8

No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/franco/Documents/Codes/fin-app/drizzle.config.ts'
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './client' is not defined by "exports" in /home/franco/Documents/Codes/fin-app/node_modules/@generouted/react-router/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:294:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:584:13)
    at resolveExports (node:internal/modules/cjs/loader:591:36)
    at Module._findPath (node:internal/modules/cjs/loader:668:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Module._resolveFilename (/home/franco/Documents/Codes/fin-app/node_modules/.pnpm/drizzle-kit@0.20.16/node_modules/drizzle-kit/bin.cjs:11284:40)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/franco/Documents/Codes/fin-app/lib/utils/router.ts:4:42) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Now, it's about generouted and a folder I use for routing, but the first error was this :

No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/franco/Documents/Codes/fin-app/drizzle.config.ts'
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/franco/Documents/Codes/fin-app/node_modules/tauri-plugin-log-api/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:294:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:584:13)
    at resolveExports (node:internal/modules/cjs/loader:591:36)
    at Module._findPath (node:internal/modules/cjs/loader:668:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Module._resolveFilename (/home/franco/Documents/Codes/fin-app/node_modules/.pnpm/drizzle-kit@0.20.16/node_modules/drizzle-kit/bin.cjs:11284:40)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/franco/Documents/Codes/fin-app/lib/utils/logger.ts:1:25) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

To get rid of the 2nd one, I had to comment every mentionning of tauri-plugin-sql in some very weird way, I have a folder ~/database that contains my schemas (~/database/schema/, the services ~/database/services/. Those services use a helper in ~/utils/helpers.ts and this helper uses the logger. To generate migration, I have to comment the line that use the logger and also the importation.

With @generouted error, since my routes are in ~/utils/router.ts, I had to comment the importation of the file also in the ~/utils/index.ts like this:

export * from './helpers'
// export * from './logger'
// export * from './router'

Expected behavior

I expect drizzle-orm to just generate files. Does it do some code analysis on those files something that causes those errors ?

Environment & setup

My drizzle.config.ts file:

import { defineConfig } from 'drizzle-kit'

import 'dotenv/config'

const dbPath = process.env.DB_PATH || 'data.db'

export default defineConfig({
  schema: './database/schema/index.ts',
  out: './src-tauri/migrations',
  verbose: true,
  strict: true,
  driver: 'libsql',
  dbCredentials: {
    url: `file:${dbPath}`
  }
})

pnpm: 9.0.4
node: 20.10.0
typescript: 5.3.3

I don't know what else to provide.

@FrancoRATOVOSON FrancoRATOVOSON added the bug Something isn't working label May 4, 2024
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

No branches or pull requests

1 participant