maxun icon indicating copy to clipboard operation
maxun copied to clipboard

SyntaxError: Cannot use import statement outside a module

Open heshanlin opened this issue 1 year ago • 5 comments

Hi,

I got an syntax error in "/home/heshanl/maxun/server/src/worker.ts" when trying to register a user. The running log was given below. Maxun was installed without using docker. Could somebody please advise on how to resolve this?

[email protected] start concurrently -k "npm run server" "npm run client"

[0] [0] > [email protected] server [0] > cross-env NODE_OPTIONS='--max-old-space-size=8000' nodemon server/src/server.ts [0] [1] [1] > [email protected] client [1] > vite [1] [0] [nodemon] 2.0.22 [0] [nodemon] to restart at any time, enter rs [0] [nodemon] watching path(s): . [0] [nodemon] watching extensions: ts,json [0] [nodemon] starting ts-node server/src/server.ts [1] The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. [1] [1] VITE v5.4.10 ready in 313 ms [1] [1] âžœ Local: http://localhost:5173/ [1] âžœ Network: use --host to expose [0] Environment variables: { REDIS_HOST: '127.0.0.1', REDIS_PORT: '6379' } [0] Worker is running... [0] Connected to Redis! [0] Debugger listening on ws://127.0.0.1:5859/3855fa26-b2d1-44ff-b182-45053e92fd67 [0] For help, see: https://nodejs.org/en/docs/inspector [0] It is highly recommended to use a minimum Redis version of 6.2.0 [0] Current: 6.0.16 [0] It is highly recommended to use a minimum Redis version of 6.2.0 [0] Current: 6.0.16 [0] Jobs: { [0] active: 0, [0] completed: 0, [0] delayed: 0, [0] failed: 0, [0] paused: 0, [0] prioritized: 0, [0] waiting: 0, [0] 'waiting-children': 0 [0] } [0] It is highly recommended to use a minimum Redis version of 6.2.0 [0] Current: 6.0.16 [0] Bucket does not exist, but MinIO was connected. [0] /home/heshanl/maxun/server/src/worker.ts:1 [0] import { Queue, Worker } from 'bullmq'; [0] ^^^^^^ [0] [0] SyntaxError: Cannot use import statement outside a module [0] at internalCompileFunction (node:internal/vm:76:18) [0] at wrapSafe (node:internal/modules/cjs/loader:1283:20) [0] at Module._compile (node:internal/modules/cjs/loader:1328:27) [0] at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) [0] at Module.load (node:internal/modules/cjs/loader:1203:32) [0] at Module._load (node:internal/modules/cjs/loader:1019:12) [0] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) [0] at node:internal/main/run_main_module:28:49 [0] [0] Node.js v18.20.4 [0] Worker exited with code: 1 [0] Database connected successfully [0] Database synced successfully! [0] 2024-11-03T12:05:59.999Z info: Server listening on port 8080

heshanlin avatar Nov 03 '24 12:11 heshanlin