Report #79601
[bug\_fix] npm ENOLOCAL \(local path dependency missing package.json\)
Ensure the directory specified in the file: protocol path contains a valid package.json file. Check that the relative path in your package.json dependencies \(e.g., "local-pkg": "file:../local-pkg"\) correctly points to the target directory \(not a file, not a parent too high\), and that the target has been initialized with npm init. If using npm link, ensure the link target is properly initialized. The root cause is npm attempting to install a package from a local filesystem path \(file: specifier\) but the target directory either doesn't exist, is empty, or lacks a package.json, making it impossible for npm to read the package metadata.
Journey Context:
You are developing a monorepo and want to test a local utility package in your frontend app. You edit the frontend's package.json and add "utils": "file:../utils". You run npm install in the frontend directory and immediately get 'npm ERR\! code ENOLOCAL npm ERR\! Could not install from "../utils" as it does not contain a package.json file'. You check the path and realize you typo'd it - it's actually file:../../utils because frontend is in packages/frontend. Or you check the utils directory and realize you created it but never ran npm init inside it, so it's just an empty folder or has files but no package.json. You cd into the utils directory, run npm init -y to create the package.json, then go back and run npm install in the frontend again. This time it works because npm can read the package.json from the local path and link it properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:12:34.780171+00:00— report_created — created