pnpm/pnpm · error · PackageManifestError::NoScript
ERR_PNPM_NO_SCRIPT
ERR_PNPM_NO_SCRIPT
Error message
Missing script: {_0:?} What it means
This is `PackageManifestError::NoImporterManifestFound` from the `pnpm-package-manifest` crate (code `ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND`). Displayed as 'No package.json was found in {_0}', it signals that the operation expected an importer (project) manifest at a given directory and none exists. The string payload is the directory searched; it is a payload, not a wrapped source.
Solutions
- Run the command from the directory (or workspace root) that actually contains `package.json`.
- Initialize the project first with `pnpm init` if the directory should be a package.
- Fix the workspace `packages:` globs in `pnpm-workspace.yaml` so they don't match manifest-less directories (or add a `package.json` to that directory).
Example fix
// before $ cd packages/docs && pnpm update # no package.json here // after $ pnpm --filter ./packages/app update
Defensive patterns
Strategy: validation
Validate before calling
fn manifest_exists(dir: &std::path::Path) -> bool {
["package.json", "package.json5", "package.yaml"]
.iter().any(|f| dir.join(f).is_file())
} Try / catch
match update() {
Err(UpdateError::PackageManifest(PackageManifestError::NoImporterManifestFound(dir))) => {
eprintln!("no package.json in {dir}; run from a project dir or run `pnpm init`")
}
other => other.expect("update failed"),
} Prevention
- Run `pnpm init` before dependency commands in new projects.
- Verify cwd is a package directory (contains package.json) before scripted updates.
- Keep workspace `packages:` globs tight so they match only real packages.
When it happens
Trigger: A command or library call that needs to read/update a project manifest runs against a directory with no `package.json` (or none of the supported manifest filenames, e.g. `package.json5`/`package.yaml` depending on support) — for example `pnpm update` pointed at a directory outside any project, or a project path in the workspace glob that lacks a manifest.
Common situations: Running `pnpm update` in a freshly created, not-yet-initialized directory; a `packages/*` workspace glob matching an empty folder or a docs-only directory; running the command from the wrong subdirectory after `cd`; the manifest was deleted or gitignored.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND
- Failed to read manifest of root-component member
- NO_IMPORTER_MANIFEST_FOUND
- ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND
- ERR_PNPM_PACKAGE_MANIFEST_INVALID_ATTRIBUTE
AI-assisted analysis of pnpm/pnpm@49dbe22c32 (2026-09-15).
Data as JSON: /api/errors/eb7ede339957f7bd.
Report an issue: GitHub.
Appendix: source
Thrown at pnpm/crates/package-manifest/src/lib.rs:73
code(ERR_PNPM_PACKAGE_JSON_EXISTS),
help("Your current working directory already has a package.json file.")
)]
AlreadyExist,
#[from(ignore)] // TODO: remove this after derive(From) has been removed
#[display("invalid attribute: {_0}")]
#[diagnostic(code(ERR_PNPM_PACKAGE_MANIFEST_INVALID_ATTRIBUTE))]
InvalidAttribute(#[error(not(source))] String),
#[from(ignore)] // TODO: remove this after derive(From) has been removed
#[display("No package.json was found in {_0}")]
#[diagnostic(code(ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND))]
NoImporterManifestFound(#[error(not(source))] String),
#[from(ignore)] // TODO: remove this after derive(From) has been removed
#[display("Missing script: {_0:?}")]
#[diagnostic(code(ERR_PNPM_NO_SCRIPT))]
NoScript(#[error(not(source))] String),
}
#[derive(Debug, Clone, Copy, PartialEq, IntoStaticStr)]
pub enum DependencyGroup {
#[strum(serialize = "dependencies")]
Prod,
#[strum(serialize = "devDependencies")]
Dev,
#[strum(serialize = "optionalDependencies")]
Optional,
#[strum(serialize = "peerDependencies")]
Peer,
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BundleDependencies {
Boolean(bool),View on GitHub (pinned to 49dbe22c32)