https://supertokens.com/ logo
m

Maxi|Shinobi

04/07/2022, 11:38 AM
I have some problems. I am currently following the quickstart guide for nodejs: https://supertokens.com/docs/emailpassword/quick-setup/backend But after installing the packages and setting the package.json to type=module I get the following error: internal/process/esm_loader.js:74 internalBinding('errors').triggerUncaughtException( ^ Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'C:_root\projects\authentication\backend\node_modules\supertokens-node\recipe\session' is not supported resolving ES modules imported from C:_root\projects\authentication\backend\index.js if I set it to commonjs I get told to set it back to module, can someone help me?
r

rp

04/07/2022, 12:22 PM
What framework are you using?
m

Maxi|Shinobi

04/07/2022, 12:36 PM
plain nodejs
r

rp

04/07/2022, 12:38 PM
hmm. Strange
How about not specifying a
type
at all in the package.json file?
We do work with type commonJS
m

Maxi|Shinobi

04/07/2022, 12:42 PM
no type at all behaves as commonjs
r

rp

04/07/2022, 12:42 PM
yea
that should work
m

Maxi|Shinobi

04/07/2022, 12:43 PM
but then it tells me that I cant use import with commonjs
k

KalibCheil

04/07/2022, 12:45 PM
change it manually. Instead of: import { errorHandler } from "supertokens-node/framework/express"; use: const { errorHandler } = require( "supertokens-node/framework/express");
I had to do that with every import
I am using commonjs
r

rp

04/07/2022, 12:47 PM
oh yea.
import .. from ..
is es6 modules style import. commonjs is
const ... = require(..)
thanks @User
m

Maxi|Shinobi

04/07/2022, 1:08 PM
thank you👍