How to fix Error: Not implemented in Node.js

Node.jsINTERMEDIATEMEDIUMUpdated Dec 9, 2025ยท 142 views

The "Not implemented" error occurs when attempting to use a feature, method, or API that has not been implemented in the current environment, library, or Node.js version. This can happen with custom stream implementations, platform-specific functions, or browser APIs in testing environments.

Quick fix

Fixes ERR_METHOD_NOT_IMPLEMENTED

Error: Not implemented
    at Readable._read (internal/streams/readable.js:...)
    at Readable.read (internal/streams/readable.js:...)
  1. Identify the exact method or feature throwing the error
  2. Implement required methods in custom classes
  3. Mock unimplemented APIs in test environments
  4. Use alternative approaches for unsupported operations
node.js โ€” error
Error: Not implemented
at Readable._read (internal/streams/readable.js:...)
at Readable.read (internal/streams/readable.js:...)
Error: Not implemented

What this error means

This error indicates that a method, function, or feature you're trying to use is not available or has not been implemented in your current runtime environment. Unlike other errors that signal bugs or misconfigurations, this error explicitly states that the functionality simply doesn't exist yet or isn't supported on your platform. The error can occur in several contexts: when extending built-in classes without implementing required methods (like custom streams), when using platform-specific Node.js APIs on unsupported operating systems, when testing with JSDOM which doesn't implement all browser APIs, or when using features that are defined in specifications but not yet available in your Node.js version. This is distinct from "method not found" errors - the method exists but intentionally returns an error because the implementation is missing or not supported in your specific environment.

Typical symptoms

  • Error thrown when calling a specific method or function
  • Custom stream classes fail when reading or writing data
  • Jest tests fail with "Not implemented" for browser APIs
  • File system operations fail with ENOSYS on certain platforms
  • HTTP client operations fail with unsupported protocols like file://
  • Platform-specific Node.js functions throw errors on incompatible OS

Common causes

  1. Custom Readable or Writable stream class missing required _read() or _write() implementation
  2. Testing environment (JSDOM) does not implement browser APIs like window.open or localStorage
  3. Using Node.js built-in fetch() with file:// URLs which are not supported
  4. Calling platform-specific functions on unsupported operating systems
  5. File system operations on filesystems that don't support symlinks or other features
  6. Third-party library expecting methods that aren't available in your Node.js version
  7. Abstract or base class method that must be overridden in subclass

How to fix "Error: Not implemented"

1Identify the exact method or feature throwing the error

Check the error stack trace to determine which method is not implemented:

javascript
Error: Not implemented
    at Readable._read (internal/streams/readable.js:...)
    at Readable.read (internal/streams/readable.js:...)

Look for the method name and context where the error occurs. This will tell you whether it's a stream implementation, file system operation, or API call.

2Implement required methods in custom classes

If you're extending built-in Node.js classes, ensure you implement all required methods. For custom streams:

javascript
const { Readable } = require('stream');

class MyReadable extends Readable {
  constructor(options) {
    super(options);
    this.data = ['chunk1', 'chunk2', 'chunk3'];
  }

  // REQUIRED: Implement _read method
  _read(size) {
    const chunk = this.data.shift();
    if (chunk) {
      this.push(chunk);
    } else {
      this.push(null); // Signal end of stream
    }
  }
}

For custom Writable streams, implement _write():

javascript
const { Writable } = require('stream');

class MyWritable extends Writable {
  _write(chunk, encoding, callback) {
    console.log(chunk.toString());
    callback(); // Signal completion
  }
}
3Mock unimplemented APIs in test environments

When testing with Jest and JSDOM, mock browser APIs that aren't implemented:

javascript
// In your test setup file or specific test
describe('Component tests', () => {
  beforeAll(() => {
    // Mock window.open
    global.open = jest.fn();

    // Mock localStorage if not implemented
    const localStorageMock = {
      getItem: jest.fn(),
      setItem: jest.fn(),
      removeItem: jest.fn(),
      clear: jest.fn(),
    };
    global.localStorage = localStorageMock;

    // Mock window.matchMedia
    Object.defineProperty(window, 'matchMedia', {
      writable: true,
      value: jest.fn().mockImplementation(query => ({
        matches: false,
        media: query,
        onchange: null,
        addListener: jest.fn(),
        removeListener: jest.fn(),
        addEventListener: jest.fn(),
        removeEventListener: jest.fn(),
        dispatchEvent: jest.fn(),
      })),
    });
  });
});
4Use alternative approaches for unsupported operations

If a feature is not implemented in your environment, find alternatives:

For file:// URLs with fetch, use the fs module instead:

javascript
// Instead of: fetch('file:///path/to/file.txt')
const fs = require('fs').promises;
const content = await fs.readFile('/path/to/file.txt', 'utf8');

For platform-specific functions, check platform and provide fallbacks:

javascript
const os = require('os');

function getNetworkInterfaces() {
  try {
    return os.networkInterfaces();
  } catch (err) {
    if (err.code === 'ENOSYS') {
      console.warn('networkInterfaces not supported on this platform');
      return {}; // Return safe fallback
    }
    throw err;
  }
}
5Check Node.js version and upgrade if needed

Some features may not be implemented in older Node.js versions. Check your version:

bash
node --version

Review the Node.js changelog to see if the feature you need is available in newer versions:

bash
# Upgrade Node.js using nvm
nvm install --lts
nvm use --lts

# Or using package manager
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# macOS
brew update
brew upgrade node

After upgrading, verify the feature is available in your version of Node.js.

6Handle platform-specific limitations

For file system operations that fail with ENOSYS, handle platform differences:

javascript
const fs = require('fs').promises;
const path = require('path');

async function createSymlink(target, linkPath) {
  try {
    await fs.symlink(target, linkPath);
  } catch (err) {
    if (err.code === 'ENOSYS') {
      console.log('Symlinks not supported, copying file instead');
      await fs.copyFile(target, linkPath);
    } else {
      throw err;
    }
  }
}

On Windows, ensure you have appropriate permissions or use junction points instead:

javascript
// Use 'junction' type for directories on Windows
if (process.platform === 'win32') {
  await fs.symlink(target, linkPath, 'junction');
}

Advanced notes

The ERR_METHOD_NOT_IMPLEMENTED error code is specifically used in Node.js core to indicate intentionally unimplemented functionality. When building libraries that need to work across different Node.js versions, use feature detection rather than version checks:

javascript
// Feature detection pattern
const hasFileURLSupport = (() => {
  try {
    new URL('file:///test');
    return true;
  } catch {
    return false;
  }
})();

For custom implementations, consider using the NotImplementedError pattern to make errors more explicit:

javascript
class NotImplementedError extends Error {
  constructor(methodName) {
    super(`Method ${methodName} is not implemented`);
    this.name = 'NotImplementedError';
    this.code = 'ERR_METHOD_NOT_IMPLEMENTED';
  }
}

class BaseClass {
  doSomething() {
    throw new NotImplementedError('doSomething');
  }
}

When working with JSDOM in tests, you can configure it to throw errors or return safe defaults for unimplemented features using the virtualConsole option to suppress warnings if they're expected. For file system limitations like ENOSYS on FAT/NTFS partitions in Linux, consider using ext4 partitions for development or implementing fallback strategies that copy files instead of creating symlinks when necessary.

Frequently asked questions

What does "ERR_METHOD_NOT_IMPLEMENTED" mean?
This error indicates that a method, function, or feature you're trying to use is not available or has not been implemented in your current runtime environment. Unlike other errors that signal bugs or misconfigurations, this error explicitly states that the functionality simply doesn't exist yet or isn't supported on your platform. js version.
How do I fix "ERR_METHOD_NOT_IMPLEMENTED"?
The "Not implemented" error occurs when attempting to use a feature, method, or API that has not been implemented in the current environment, library, or Node.js version. This can happen with custom stream implementations, platform-specific functions, or browser APIs in testing environments.
What causes "ERR_METHOD_NOT_IMPLEMENTED"?
Custom Readable or Writable stream class missing required _read() or _write() implementation Testing environment (JSDOM) does not implement browser APIs like window.open or localStorage Using Node.js built-in fetch() with file:// URLs which are not supported
Is the "ERR_METHOD_NOT_IMPLEMENTED" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading