{"record":{"id":"a1688127032ac5bf","repo":"hoppscotch/hoppscotch","slug":"pm-require-packagename-is-not-supported-in-h-a16881","errorCode":null,"errorMessage":"pm.require('${packageName}') is not supported in Hoppscotch (Package Library feature)","messagePattern":"pm\\.require\\('(.+?)'\\) is not supported in Hoppscotch \\(Package Library feature\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/hoppscotch-js-sandbox/src/bootstrap-code/pre-request.js","lineNumber":1633,"sourceCode":"        throw new Error(\n          \"pm.execution.setNextRequest() is not supported in Hoppscotch (Collection Runner feature)\"\n        )\n      },\n      skipRequest: () => {\n        throw new Error(\n          \"pm.execution.skipRequest() is not supported in Hoppscotch (Collection Runner feature)\"\n        )\n      },\n      runRequest: () => {\n        throw new Error(\n          \"pm.execution.runRequest() is not supported in Hoppscotch (Collection Runner feature)\"\n        )\n      },\n    },\n\n    // Package imports (unsupported)\n    require: (packageName) => {\n      throw new Error(\n        `pm.require('${packageName}') is not supported in Hoppscotch (Package Library feature)`\n      )\n    },\n  }\n}\n","sourceCodeStart":1615,"sourceCodeEnd":1639,"githubUrl":"https://github.com/hoppscotch/hoppscotch/blob/1acb8a3a7581e4db32ba0d529170c4669a2e1053/packages/hoppscotch-js-sandbox/src/bootstrap-code/pre-request.js#L1615-L1639","documentation":"`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(...)`.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the `pm.require(...)` import; Hoppscotch scripts must be self-contained.","Inline the specific helper logic you need (the sandbox exposes standard JS; avoid relying on npm packages).","For utilities like crypto/uuid, use the built-in `crypto` module exposed by the sandbox instead of a required package."],"exampleFix":"// before\nconst _ = pm.require(\"lodash\")\nconst val = _.get(obj, \"a.b\")\n// after - inline the small helper you actually need\nconst val = obj && obj.a && obj.a.b","handlingStrategy":"validation","validationCode":"const UNSUPPORTED = /pm\\.require\\s*\\(/\nfunction assertNoRequire(src) {\n  if (UNSUPPORTED.test(src)) throw new Error(\"pm.require() is unsupported in Hoppscotch\")\n}","typeGuard":null,"tryCatchPattern":"try { /* run script */ }\ncatch (e) {\n  if (/pm\\.require\\('.*'\\) is not supported/.test(e?.message)) {\n    /* inline the needed helper */\n  } else throw e\n}","preventionTips":["Keep scripts self-contained; do not depend on npm packages via pm.require.","Prefer built-in sandbox APIs (crypto, JSON, etc.) over external libraries."],"tags":["hoppscotch","postman-compat","package-library","require"],"backgroundTag":null,"analyzedSha":"1acb8a3a7581e4db32ba0d529170c4669a2e1053","analyzedAt":"2026-08-12T11:34:52.648Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}