uuidjs/uuid

Error when importing uuid module in node.js v14.17.1

MarcoCiaramella opened this issue · 1 comments

Description

Importing uuid module in node.js v14.17.1 cause error

export { default as v1 } from './v1.js';
^^^^^^

SyntaxError: Unexpected token 'export'

How to reproduce

Install uuid module as
npm install uuid --save

In a new file index.js add the line
const { v4: uuidv4 } = require('uuid');
then run
node index.js

Runtime

  • OS: Windows 10
  • Runtime: Node.js
  • Runtime Version: 14.17.1

You can't require ESM modules.