symbology icon indicating copy to clipboard operation
symbology copied to clipboard

quick start not working? SyntaxError: Named export 'EncodingMode' not found.

Open wivaku opened this issue 1 year ago • 0 comments

Using quick start example:

import {
  OutputOption,
  EncodingMode,
  SymbologyType,
  createStream
} from 'symbology'

(async () => {
  try {
    const { data } = await createFile({
      symbology: SymbologyType.CODE128,
      encoding: EncodingMode.GS1_MODE,
      fileName: 'out.svg',
      backgroundColor: '00000000',
      foregroundColor: '00FF00FF'
    }, '12345')

    console.log('File successfully created.')
  } catch (err) {
    console.error('Error: ', err)
  }
})()

Results in error message:

$ node --version ## result: v16.16.0
$ yarn add symbology
$ node quick_start_symbology.js
file:///.../quick_start_symbology.js:3
	EncodingMode,
	^^^^^^^^^^^^
SyntaxError: Named export 'EncodingMode' not found. The requested module 'symbology' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'symbology';

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

Am I doing something wrong?

wivaku avatar Aug 08 '22 16:08 wivaku