{"record":{"id":"eb7ede339957f7bd","repo":"pnpm/pnpm","slug":"err-pnpm-no-script-eb7ede","errorCode":"ERR_PNPM_NO_SCRIPT","errorMessage":"Missing script: {_0:?}","messagePattern":"Missing script: (.+?)","errorType":"exception","errorClass":"PackageManifestError","httpStatus":null,"severity":"error","filePath":"pnpm/crates/package-manifest/src/lib.rs","lineNumber":55,"sourceCode":"        code(ERR_PNPM_PACKAGE_JSON_EXISTS),\n        help(\"Your current working directory already has a package.json file.\")\n    )]\n    AlreadyExist,\n\n    #[from(ignore)] // TODO: remove this after derive(From) has been removed\n    #[display(\"invalid attribute: {_0}\")]\n    #[diagnostic(code(ERR_PNPM_PACKAGE_MANIFEST_INVALID_ATTRIBUTE))]\n    InvalidAttribute(#[error(not(source))] String),\n\n    #[from(ignore)] // TODO: remove this after derive(From) has been removed\n    #[display(\"No package.json was found in {_0}\")]\n    #[diagnostic(code(ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND))]\n    NoImporterManifestFound(#[error(not(source))] String),\n\n    #[from(ignore)] // TODO: remove this after derive(From) has been removed\n    #[display(\"Missing script: {_0:?}\")]\n    #[diagnostic(code(ERR_PNPM_NO_SCRIPT))]\n    NoScript(#[error(not(source))] String),\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, IntoStaticStr)]\npub enum DependencyGroup {\n    #[strum(serialize = \"dependencies\")]\n    Prod,\n    #[strum(serialize = \"devDependencies\")]\n    Dev,\n    #[strum(serialize = \"optionalDependencies\")]\n    Optional,\n    #[strum(serialize = \"peerDependencies\")]\n    Peer,\n}\n\n#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]\n#[serde(untagged)]\npub enum BundleDependencies {\n    Boolean(bool),","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/pnpm/pnpm/blob/6261b7f388016d57ca6b90340342411cd1d0d00f/pnpm/crates/package-manifest/src/lib.rs#L37-L73","documentation":"PackageManifest::script(command, if_present=false) raises ERR_PNPM_NO_SCRIPT when scripts.<command> is absent from package.json (lib.rs:467). The `pnpm run` / `pnpm <script>` path surfaces it (cli run.rs converts it into RunError::NoScript with a hint). With --if-present the same lookup returns Ok(None) instead of an error.","triggerScenarios":"Run `pnpm build` or `pnpm run test` in a package whose scripts object lacks that key; typo in the script name; running in the wrong package of a monorepo where the script exists only in a sibling.","commonSituations":"Fresh clone before script setup; renamed scripts; monorepo root vs package confusion; CI invoking a script name that drifted from package.json.","solutions":["Check the exact key under scripts in package.json and fix the typo.","Add the missing script to package.json.","Run `pnpm run` with no arguments to list available scripts.","Use `pnpm run <script> --if-present` when absence is acceptable."],"exampleFix":"# before\n$ pnpm bulid\nERR_PNPM_NO_SCRIPT Missing script: bulid\n# after\n$ pnpm build","handlingStrategy":"validation","validationCode":"const pkg = require('./package.json');\nfunction assertScript(name) {\n  if (!hasScript(pkg, name))\n    throw new Error('script not found: ' + name + '; available: ' + Object.keys(pkg.scripts || {}).join(', '));\n}","typeGuard":"function hasScript(pkg, name) {\n  return typeof pkg.scripts?.[name] === 'string';\n}","tryCatchPattern":null,"preventionTips":["List scripts with `pnpm run` before hard-coding names in CI.","Use --if-present for optional lifecycle scripts.","Rename scripts in lockstep with the CI pipelines that call them."],"tags":["pnpm","scripts","run","package-json"],"backgroundTag":"npm-script-not-found","analyzedSha":"6261b7f388016d57ca6b90340342411cd1d0d00f","analyzedAt":"2026-08-17T18:30:54.750Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}