Installation Troubleshooting

Common issues and solutions when installing and using the Extended Markdown ADF Parser.

Module System Issues

"Cannot use import statement outside a module"

This package supports both CommonJS and ES Modules. Choose the approach that works for your environment:

Solution 1: Use CommonJS (Easiest)

const { Parser } = require('extended-markdown-adf-parser');

Solution 2: Enable ES Modules in package.json

{
  "type": "module"
}

Then use:

import { Parser } from 'extended-markdown-adf-parser';

Solution 3: Use .mjs file extension

mv script.js script.mjs

Solution 4: Use dynamic import in CommonJS

const { Parser } = await import('extended-markdown-adf-parser');

"require() of ES modules is not supported"

This error occurs when trying to use require() on an ES module. Since this package supports both formats, use the appropriate import method:

Solution:

Mixed Module Systems

If you're mixing CommonJS and ES Modules in the same project:

"Module not found" in TypeScript

Solution: Check your tsconfig.json module resolution:

Performance Issues with Large Documents

Solution: Use the streaming parser:

Volta Version Management Issues

If you're having trouble with Volta automatically switching versions:

Check Volta Configuration:

Restart Shell:

Package Installation Failures

Network/Registry Issues

Solution 1: Clear npm cache

Solution 2: Use different registry

Permission Issues

Solution 1: Use npx for global installs

Solution 2: Fix npm permissions (Unix/macOS)

TypeScript Compilation Errors

Missing Type Definitions

The package includes built-in TypeScript definitions, but if you encounter issues:

Module Resolution Issues

Update your tsconfig.json:

ESM/CommonJS Compatibility

Mixing Module Systems

Error: require() of ES modules is not supported

Solution: Use dynamic imports consistently:

Jest Testing Issues

For Jest testing with ESM:

jest.config.js:

Memory Issues with Large Files

Heap Out of Memory

Solution: Increase Node.js memory limit

Use Streaming Parser

Getting Help

If you encounter installation issues not covered here:

Information to Include

When reporting installation issues, please include:

  • Node.js version (node --version)

  • npm/Yarn version

  • Operating system and version

  • Complete error messages

  • Package.json configuration

  • Steps to reproduce the issue

Environment Debugging

System Information:

Package Information:

Recent TypeScript Improvements (v1.2.1+)

If you were experiencing TypeScript compilation errors with earlier versions, these issues have been resolved in recent updates:

Fixed Type Issues

  • MediaNode alt property: The MediaNode interface now properly includes the optional alt attribute

  • ValidationError line property: The ValidationError interface now includes the optional line property for better error reporting

  • Metadata comments: Fixed Data interface extension for ADF metadata handling

  • AJV validator types: Improved type safety for schema validation functions

Upgrading from Earlier Versions

If you're upgrading from versions prior to 1.2.1 and experiencing TypeScript errors:

These fixes ensure full TypeScript compatibility without any compilation errors.

Last updated