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

Error while locating templates files in a monorepo structure #1232

Open
synicko opened this issue Jul 25, 2024 · 2 comments
Open

Error while locating templates files in a monorepo structure #1232

synicko opened this issue Jul 25, 2024 · 2 comments
Labels
c: bug Something isn't working has workaround Workaround provided or linked help wanted Extra attention is needed p: 1-normal Nothing urgent

Comments

@synicko
Copy link

synicko commented Jul 25, 2024

Describe the bug

Structure of my projet

/monorepo
  node_modules
  packages
    server
      migrations
      node_modules

The server package contains the script to create migrations.
When I run node-pg-migrate create -j ts, the binary tries to load the templates files from the server node_modules folder and throws an error because the monorepo node_modules folder contains the package
I found a workaround by adding the option --templateFileName ../../node_modules/node-pg-migrate/templates/migration-template.ts to the command line but didn't have the problem in previous versions of node-pg-migrate

Steps to reproduce

cd [path_to_monorepo]/packages/server
node-pg-migrate create -j ts [migration_name]

Logs

[Error: ENOENT: no such file or directory, open '[...]/monorepo/packages/server/node_modules/node-pg-migrate/templates/migration-template.ts'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '[...]/monorepo/packages/server/node_modules/node-pg-migrate/templates/migration-template.ts'
}

System Info

MacOS Somona 14.5
Node 20.15.1
node-pg-migrate 7.5.2

Used Module System

esm

@synicko synicko added the s: pending triage Pending Triage label Jul 25, 2024
@Shinigami92
Copy link
Collaborator

I knew this will bite me 😣
This is coming from #1208

/ping @aprendendofelipe

Potentially you need to live with the workaround for now and wait until node-pg-migrate is esm only

@Shinigami92 Shinigami92 added has workaround Workaround provided or linked c: bug Something isn't working help wanted Extra attention is needed p: 1-normal Nothing urgent and removed s: pending triage Pending Triage labels Jul 25, 2024
@MrPiao
Copy link

MrPiao commented Oct 3, 2024

Can confirm this repros @ 7.7.0, and that the workaround still works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working has workaround Workaround provided or linked help wanted Extra attention is needed p: 1-normal Nothing urgent
Projects
None yet
Development

No branches or pull requests

3 participants