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

Fails on SyntaxError: Cannot use import statement outside a module #67

Open
madsvcarlsen opened this issue Nov 1, 2021 · 2 comments
Open

Comments

@madsvcarlsen
Copy link

madsvcarlsen commented Nov 1, 2021

Not sure if this project is abandoned, but here goes, since an image was pushed 2 days ago; I'm using the latest docker image, and it fails with the following:

rhythm-bot@2.1.5 start:prod /home/rhythmbot

NODE_ENV=production node --trace-warnings dist/app

== Migration20211031234554: migrating =======

/home/rhythmbot/migrations/Migration20211031234554.ts:1

import { Migration } from '@mikro-orm/migrations';

^^^^^^

SyntaxError: Cannot use import statement outside a module

at wrapSafe (internal/modules/cjs/loader.js:915:16)

at Module._compile (internal/modules/cjs/loader.js:963:27)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

at Module.load (internal/modules/cjs/loader.js:863:32)

at Function.Module._load (internal/modules/cjs/loader.js:708:14)

at Module.require (internal/modules/cjs/loader.js:887:19)

at require (internal/modules/cjs/helpers.js:74:18)

at Migrator.resolve (/home/rhythmbot/node_modules/@mikro-orm/migrations/Migrator.js:141:27)

at Object.customResolver (/home/rhythmbot/node_modules/@mikro-orm/migrations/Migrator.js:43:44)

at Migration.migration (/home/rhythmbot/node_modules/umzug/lib/migration.js:60:38)

at /home/rhythmbot/node_modules/umzug/lib/migration.js:121:37

at Generator.next (<anonymous>)

at asyncGeneratorStep (/home/rhythmbot/node_modules/umzug/lib/migration.js:9:103)

at _next (/home/rhythmbot/node_modules/umzug/lib/migration.js:11:194)

at /home/rhythmbot/node_modules/umzug/lib/migration.js:11:364

at new Promise (<anonymous>)

rhythm-bot@2.1.5 start:prod /home/rhythmbot

NODE_ENV=production node --trace-warnings dist/app

== Migration20211031234554: migrating =======

/home/rhythmbot/migrations/Migration20211031234554.ts:1

import { Migration } from '@mikro-orm/migrations';

^^^^^^

SyntaxError: Cannot use import statement outside a module

at wrapSafe (internal/modules/cjs/loader.js:915:16)

at Module._compile (internal/modules/cjs/loader.js:963:27)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

at Module.load (internal/modules/cjs/loader.js:863:32)

at Function.Module._load (internal/modules/cjs/loader.js:708:14)

at Module.require (internal/modules/cjs/loader.js:887:19)

at require (internal/modules/cjs/helpers.js:74:18)

at Migrator.resolve (/home/rhythmbot/node_modules/@mikro-orm/migrations/Migrator.js:141:27)

at Object.customResolver (/home/rhythmbot/node_modules/@mikro-orm/migrations/Migrator.js:43:44)

at Migration.migration (/home/rhythmbot/node_modules/umzug/lib/migration.js:60:38)

at /home/rhythmbot/node_modules/umzug/lib/migration.js:121:37

at Generator.next (<anonymous>)

at asyncGeneratorStep (/home/rhythmbot/node_modules/umzug/lib/migration.js:9:103)

at _next (/home/rhythmbot/node_modules/umzug/lib/migration.js:11:194)

at /home/rhythmbot/node_modules/umzug/lib/migration.js:11:364

at new Promise (<anonymous>)
@Malexion
Copy link
Owner

Malexion commented Nov 1, 2021

@dudeofawesome Not sure if you've encountered this, but it seems like migrations isn't getting parsed correctly when run through docker. Maybe "start:prod" needs to be run with ts-node?

@madsvcarlsen
Copy link
Author

I can confirm, that using only 'start' which registers ts-node works with the latest image.

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

No branches or pull requests

2 participants