{"record":{"id":"b856c8d95919bf72","repo":"parcel-bundler/parcel","slug":"node-builtin-polyfill-packagename-is-not-inst","errorCode":null,"errorMessage":"Node builtin polyfill \"${packageName}\" is not installed, but auto install is disabled.","messagePattern":"Node builtin polyfill \"(.+?)\" is not installed, but auto install is disabled\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/utils/node-resolver-core/src/Wrapper.js","lineNumber":335,"sourceCode":"            this.options.projectRoot + '/index',\n            {\n              saveDev: true,\n              shouldAutoInstall: true,\n              range: builtin.range,\n            },\n          );\n\n          // Need to clear the resolver caches after installing the package\n          this.resolversByEnv.clear();\n\n          // Re-resolve\n          return this.resolve({\n            ...options,\n            filename: builtin.name,\n            parent: this.options.projectRoot + '/index',\n          });\n        } else {\n          throw new ThrowableDiagnostic({\n            diagnostic: {\n              message: md`Node builtin polyfill \"${packageName}\" is not installed, but auto install is disabled.`,\n              codeFrames: options.loc\n                ? [\n                    {\n                      filePath: options.loc.filePath,\n                      codeHighlights: [\n                        convertSourceLocationToHighlight(\n                          options.loc,\n                          'used here',\n                        ),\n                      ],\n                    },\n                  ]\n                : [],\n              documentationURL:\n                'https://parceljs.org/features/node-emulation/#polyfilling-%26-excluding-builtin-node-modules',\n              hints: [","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/utils/node-resolver-core/src/Wrapper.js#L317-L353","documentation":"Thrown by @parcel/node-resolver-core when a Node builtin (e.g. 'crypto', 'fs', 'path') is imported in a browser/electron-renderer environment, the matching polyfill package is not installed, and auto-install is disabled. The resolver knows the canonical polyfill per builtin (e.g. crypto-browserify) and would auto-install it if shouldAutoInstall were true; otherwise it throws with a documentationURL and a hint to install the package manually.","triggerScenarios":"A dependency imports a Node builtin; the target env is browser-like; the polyfill package is absent from node_modules; and this.options.shouldAutoInstall is false. options.loc, if present, is rendered as a codeframe highlighting the import.","commonSituations":"A browser build pulling in a library that uses Node builtins, Parcel v2 defaulting autoInstall off in CI, or a polyfill package removed during dependency cleanup.","solutions":["Install the named polyfill package: `npm install <packageName>` (the message names it, e.g. crypto-browserify).","Enable auto-install: pass --auto-install or set shouldAutoInstall in the Parcel config.","If the import is unwanted, alias/exclude the builtin via Parcel's node-emulation config.","Pin the version range suggested by builtin.range to avoid resolver warnings."],"exampleFix":"// before\nimport { createHash } from 'crypto';  // browser env, no polyfill, autoInstall off\n// after\n$ npm install crypto-browserify\n// or in .parcelrc/resolve config alias 'crypto' -> 'crypto-browserify'","handlingStrategy":"validation","validationCode":"const NODE_BUILTINS = new Set(['fs','path','crypto','os','stream','buffer',/*...*/]);\nconst POLYFILLS = { crypto: 'crypto-browserify', stream: 'stream-browserify', buffer: 'buffer', path: 'path-browserify' /* ... */ };\nfor (const spec of imports) {\n  if (NODE_BUILTINS.has(spec) && env.targetsBrowser) {\n    const pkg = POLYFILLS[spec];\n    if (!await packageIsInstalled(pkg)) throw new Error(`Install ${pkg} to polyfill Node builtin '${spec}'`);\n  }\n}","typeGuard":"function isNodeBuiltin(spec) {\n  return new Set(['fs','path','crypto','os','stream','buffer','http','https','zlib','url','util']).has(spec);\n}","tryCatchPattern":null,"preventionTips":["Pre-install browser polyfills for any Node builtin a dependency may import.","Enable --auto-install in dev to let Parcel fetch polyfills on demand.","Audit third-party deps for Node-builtin usage before targeting browsers."],"tags":["resolver","node-builtin","polyfill","browser-env","parcel"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}