SyntaxError: Cannot use import statement outside a module
dskvr opened this issue · 1 comments
dskvr commented
When attempting to import into a Typescript project.
import fs, {promises as fsPromises} from 'node:fs';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:895:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
dskvr commented
User error, NVM was on NodeJS 12x in the window. Using 14x resolved the issue.
Sorry about that!