You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am new to node and trying to run the basic example you provide. When I run it I get
import { createClient } from 'redis';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1187:20)
at Module._compile (node:internal/modules/cjs/loader:1231:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Node.js v20.0.0
Node.js Version
v20.0.0
Redis Server Version
latest docker image
Node Redis Version
redis@4.6.12
Platform
Windows 10
Logs
import { createClient } from 'redis';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1187:20)
at Module._compile (node:internal/modules/cjs/loader:1231:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Node.js v20.0.0
The text was updated successfully, but these errors were encountered:
@eliassal not a bug of node-redis, maybe you have not configured the "module" type in your package.json, hence Node is treating it as CommonJS, which does not support import statements
Description
Hi, I am new to node and trying to run the basic example you provide. When I run it I get
import { createClient } from 'redis';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1187:20)
at Module._compile (node:internal/modules/cjs/loader:1231:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Node.js v20.0.0
Node.js Version
v20.0.0
Redis Server Version
latest docker image
Node Redis Version
redis@4.6.12
Platform
Windows 10
Logs
The text was updated successfully, but these errors were encountered: