{"id":26573,"library":"update-package","title":"update-package","description":"A Node.js library (v0.2.0, last updated February 2015) for updating or linting a package.json file against a set of defaults. Originally designed to enforce consistent fields across multiple projects, it appears to read a template/defaults object and merge it into an existing package.json. The package is minimal, using only Node's built-in fs and path modules, and has no significant external dependencies. Its development cadence is very low (single release), and it has been largely superseded by more active tools like sort-package-json or npm-check. The project is now archived/unmaintained.","status":"abandoned","version":"0.2.0","language":"javascript","source_language":"en","source_url":"git://github.com/jonschlinkert/update-package","tags":["javascript"],"install":[{"cmd":"npm install update-package","lang":"bash","label":"npm"},{"cmd":"yarn add update-package","lang":"bash","label":"yarn"},{"cmd":"pnpm add update-package","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses CJS, no ESM export. Requires Node >=0.10.0.","wrong":"import updatePkg from 'update-package'","symbol":"default","correct":"const updatePkg = require('update-package')"},{"note":"Function returns a modified package.json object; no constructor.","wrong":"const updatePkg = new (require('update-package'))(defaults, pkg)","symbol":"none (callable)","correct":"const updatePkg = require('update-package')(defaults, pkg)"},{"note":"No TypeScript types provided; use @types/update-package if available (not on DefinitelyTyped).","wrong":"","symbol":"none (type)","correct":"const updatePkg = require('update-package')"}],"quickstart":{"code":"const updatePkg = require('update-package');\nconst defaults = { name: 'my-app', version: '1.0.0' };\nconst pkg = { name: 'my-app', version: '0.9.0', private: true };\nconst result = updatePkg(defaults, pkg);\nconsole.log(result);\n// { name: 'my-app', version: '1.0.0', private: true }","lang":"javascript","description":"Shows how to require the package and use it to update a package.json object with default values."},"warnings":[{"fix":"Use sort-package-json or migrate to npm's built-in defaults.","message":"Package is unmaintained since 2015. Use modern alternatives like sort-package-json or npm init.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Pass a shallow copy of defaults: updatePkg({...defaults}, pkg)","message":"The function mutates the first argument (defaults) and returns it; does not create a deep copy.","severity":"gotcha","affected_versions":"<=0.2.0"},{"fix":"Use dynamic import or rewrite to use require.","message":"Only works with CommonJS require; not ESM compatible and no dual build.","severity":"gotcha","affected_versions":"<=0.2.0"},{"fix":"Switch to a maintained alternative.","message":"No longer maintained; known issues with npm v2+ and newer Node versions may cause unexpected behavior.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install update-package'","cause":"Package not installed or npm install failed.","error":"Error: Cannot find module 'update-package'"},{"fix":"Use 'const updatePkg = require('update-package')' instead of 'import updatePkg from ...'.","cause":"Using ES6 import syntax with CJS package.","error":"TypeError: updatePkg is not a function"},{"fix":"Ensure first argument is an object with required fields.","cause":"Missing or invalid defaults object as first argument.","error":"TypeError: Cannot read property 'name' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}