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
@btw-aak▲ 4 net votes
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.