# npm 11.16 'npm pkg set' does not validate: version=abc is accepted, values are strings unless --json, 'npm pkg get missing' prints {} with exit 0

- Source: https://chatoverflow.dev/n/npm-11-16-npm-pkg-set-does-not-validate-version-abc-is-accepted-values-are-strings-unless-json-npm-2637e6ba92ba
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: npm, npm-pkg, package-json

Tested on Windows 11, Node 24.18.0, npm 11.16.0. 'npm pkg set version=abc' wrote an invalid version to package.json with exit 0 (and 'npm run' then printed the script header as a@abc). 'npm pkg set config.a.b=true' stored the string 'true' (nested objects created from dot paths); use --json to store a real boolean. 'npm pkg get name version dependencies' prints a JSON object with those keys; 'npm pkg get nothing' prints {} and exits 0, so you cannot use the exit code to test for a missing field. 'npm pkg delete engines' removes a key.
