hoppscotch/hoppscotch · error · Error

pm.require('${packageName}') is not supported in Hoppscotch

Error message

pm.require('${packageName}') is not supported in Hoppscotch (Package Library feature)

What it means

`pm.require()` is Postman's Package Library feature for importing shared JS modules into scripts. Hoppscotch has no package library, so the stub at pre-request.js:1632 throws with the offending package name interpolated into the message. The error is thrown synchronously when the script first calls `pm.require(...)`.

Source

Thrown at packages/hoppscotch-js-sandbox/src/bootstrap-code/pre-request.js:1633

        throw new Error(
          "pm.execution.setNextRequest() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
      skipRequest: () => {
        throw new Error(
          "pm.execution.skipRequest() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
      runRequest: () => {
        throw new Error(
          "pm.execution.runRequest() is not supported in Hoppscotch (Collection Runner feature)"
        )
      },
    },

    // Package imports (unsupported)
    require: (packageName) => {
      throw new Error(
        `pm.require('${packageName}') is not supported in Hoppscotch (Package Library feature)`
      )
    },
  }
}

View on GitHub (pinned to 1acb8a3a75)

Solutions

  1. Remove the `pm.require(...)` import; Hoppscotch scripts must be self-contained.
  2. Inline the specific helper logic you need (the sandbox exposes standard JS; avoid relying on npm packages).
  3. For utilities like crypto/uuid, use the built-in `crypto` module exposed by the sandbox instead of a required package.

Example fix

// before
const _ = pm.require("lodash")
const val = _.get(obj, "a.b")
// after - inline the small helper you actually need
const val = obj && obj.a && obj.a.b
Defensive patterns

Strategy: validation

Validate before calling

const UNSUPPORTED = /pm\.require\s*\(/
function assertNoRequire(src) {
  if (UNSUPPORTED.test(src)) throw new Error("pm.require() is unsupported in Hoppscotch")
}

Try / catch

try { /* run script */ }
catch (e) {
  if (/pm\.require\('.*'\) is not supported/.test(e?.message)) {
    /* inline the needed helper */
  } else throw e
}

Prevention

When it happens

Trigger: Calling `pm.require("some-package")` (any string argument) inside a Hoppscotch script. The arrow function at pre-request.js:1632 throws immediately, echoing the requested package name.

Common situations: Scripts using Postman's Package Library (e.g. `pm.require('lodash')`, `pm.require('moment')`, or internal shared modules). Code migrated from Postman that depends on imported utility libraries. CI that runs the same script across both tools.

Related errors


AI-assisted analysis of hoppscotch/hoppscotch@1acb8a3a75 (2026-08-12). Data as JSON: /api/errors/a1688127032ac5bf. Report an issue: GitHub.