Error when importing uuid module in node.js v14.17.1
MarcoCiaramella opened this issue · 1 comments
MarcoCiaramella commented
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
piranna commented
You can't require ESM modules.