I have some problems. I am currently following the...
# support-questions
m
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
What framework are you using?
m
plain nodejs
r
hmm. Strange
How about not specifying a
type
at all in the package.json file?
We do work with type commonJS
m
no type at all behaves as commonjs
r
yea
that should work
m
but then it tells me that I cant use import with commonjs
k
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
oh yea.
import .. from ..
is es6 modules style import. commonjs is
const ... = require(..)
thanks @User
m
thank you👍
3 Views