Unexpected Token always on the first line

import { capitalize, InstallGlobalCommands } from './utils.js';
import { getRPSChoices } from './game.js';
import 'dotenv/config';

This is cloned from discord official getting-started.
I always have Unexpected Token error on the first import line.
Looks like something’s wrong with the parser?

The error I got is

> node commands.js

/app/commands.js:1
import { capitalize, InstallGlobalCommands } from './utils.js';
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! getting-started@1.0.0 register: `node commands.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the getting-started@1.0.0 register script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

might be too old of a node.js version

1 Like