Npm Explained

npm
npm
Author:Isaac Z. Schlueter
Developer:npm, Inc. (a subsidiary of GitHub,[1] a subsidiary of Microsoft)
Released:[2]
Programming Language:JavaScript
Platform:Cross-platform
Genre:Package manager
License:Artistic License 2.0

npm is a package manager for the JavaScript programming language maintained by npm, Inc., a subsidiary of GitHub. npm is the default package manager for the JavaScript runtime environment Node.js and is included as a recommended feature in the Node.js installer.[3]

It consists of a command line client, also called npm, and an online database of public and paid-for private packages, called the npm registry. The registry is accessed via the client, and the available packages can be browsed and searched via the npm website. The package manager and the registry are managed by npm, Inc.

Although "npm" is commonly understood to be an abbreviation of "Node Package Manager", it is officially a recursive backronymic abbreviation for "npm is not an acronym".[4]

Characteristics

npm can manage packages that are local dependencies of a particular project, as well as globally-installed JavaScript tools.[5] When used as a dependency manager for a local project, npm can install, in one command, all the dependencies of a project through the package.json file.[6] In the package.json file, each dependency can specify a range of valid versions using the semantic versioning scheme, allowing developers to auto-update their packages while at the same time avoiding unwanted breaking changes.[7] npm also provides version-bumping tools for developers to tag their packages with a particular version.[8] npm also provides the package-lock.json[9] file which has the entry of the exact version used by the project after evaluating semantic versioning in package.json.

The npx command, which is an acronym for Node Package eXecuter,[10] executes packages without installing them.

npm's command-line interface client allows users to consume and distribute JavaScript modules that are available in the registry.[11] In npm version 6, the audit feature was introduced to help developers identify and fix security vulnerabilities in installed packages.[12] The source of security vulnerabilities were taken from reports found on the Node Security Platform (NSP) and has been integrated with npm since npm's acquisition of NSP.[13]

Registry

Packages in the registry are in ECMAScript Module (ESM) or CommonJS format and include a metadata file in JSON format.[14] Over 3.1 million packages are available in the main npm registry.[15] The registry does not have any vetting process for submission, which means that packages found there can potentially be low quality, insecure, or malicious. Instead, npm relies on user reports to take down packages if they violate policies by being low quality, insecure, or malicious.[16] npm exposes statistics including number of downloads and number of depending packages to assist developers in judging the quality of packages.[17] Internally npm relies on the NoSQL Couch DB to manage publicly available data.[18]

History

npm (originally short for Node Package Manager) was created in 2010 by as a response to existing module packaging systems in the JavaScript ecosystem, which he considered to be inadequate. Schlueter was influenced by earlier tools such as PEAR for PHP and CPAN for Perl, and aimed to develop a lightweight, community-oriented package manager designed for the Node.js runtime.[19]

npm was introduced as a more capable alternative to an earlier shell script-based tool named pm, which had limited features for managing Node.js packages.[20] The first version of npm was released on January 12, 2010.[21]

Over time, npm was increasingly adopted within the Node.js developer community. Its ease of use, speed, and ability to distribute reusable code contributed to its widespread usage as a package manager. It played a significant role in the development of the JavaScript ecosystem by enabling efficient dependency management and sharing of open-source libraries.

In 2014, the company npm, Inc. was established in Oakland, California by Schlueter and Laurie Voss to oversee the maintenance of the npm registry and to provide related services.[22]

In July 2018, Bryan Bogensberger was appointed as CEO of npm, Inc. During his tenure, the company faced both technical and community challenges, including concerns related to registry performance and organizational transparency.[23] Voss departed the company in July 2019, followed by Bogensberger in September of the same year.[24]

In March 2020, npm, Inc. was acquired by GitHub, a subsidiary of Microsoft. The acquisition was presented as a step toward improving the infrastructure of the npm registry and strengthening integration with GitHub’s developer tools.[25]

Post-acquisition, GitHub committed to keeping the public npm registry free to use and open to the developer community. It also announced enhancements including improved security features, better command-line tooling, and publishing support via GitHub Actions.

As of 2025, npm remains one of the most widely used software package registries, hosting a substantial number of open-source packages and serving billions of downloads on a regular basis. It continues to serve as a central infrastructure component for JavaScript and web development workflows.

Package controversies

left-pad

See also: Npm left-pad incident. In March 2016, a package called left-pad was unpublished as the result of a naming dispute between Azer Koçulu, an individual software engineer, and Kik.[26] [27] The package was immensely popular on the platform, being depended on by thousands of projects and reaching 15million downloads prior to its removal.[28] Several projects critical to the JavaScript ecosystem including Babel and Webpack depended on left-pad and were rendered unusable.[29] Although the package was republished three hours later,[30] it caused widespread disruption, leading npm to change its policies regarding unpublishing to prevent a similar event in the future.[31]

flatmap-stream

In November 2018, it was discovered that a malicious package had been added as a dependency to version 3.3.6 of the popular package event-stream.[32] The malicious package, called flatmap-stream, contained an encrypted payload that stole bitcoins from certain applications.[33]

pac-resolver

In May 2021, pac-resolver, an npm package that received over 3million downloads per week, was discovered to have a remote code execution vulnerability.[34] The vulnerability resulted from how the package handled config files, and was fixed in versions 5 and greater.[35]

colors and faker

In January 2022, the maintainer of the popular package colors pushed changes printing garbage text in an infinite loop. The maintainer also cleared the repository of another popular package, faker, and its package on npm, and replaced it with a README that read, "What really happened to Aaron Swartz?"[36]

node-ipc and peacenotwar

See also: peacenotwar. In March 2022, developer Brandon Nozaki Miller, maintainer of the node-ipc package, added peacenotwar as a dependency to the package. peacenotwar recursively overwrites an affected machine's hard drive contents with the heart emoji if they have a Belarusian or Russian IP address. The package also leaves a text file on the machine containing a message in protest of the Russian invasion of Ukraine. Vue.js, which uses node-ipc as a dependency, did not pin its dependencies to a safe version, meaning that some users of Vue.js had the peacenotwar package if they were using its latest version.[37] [38] The package was also briefly present as a dependency in version 3.1 of Unity Hub. However, a hotfix was released the same day to remove the dependency.[39]

bignum

In May 2023, several npm packages including bignum were found to be exploited, stealing user credentials and information from affected machines. Researchers discovered that these packages had been compromised through an exploit involving Amazon S3 buckets and the node-gyp command line tool.[40]

September 2025 supply chain attack

In September 2025, up to 18 popular npm packages were compromised with malware as part of a supply chain attack. Packages were compromised through a phishing attack on the package maintainers. After the account was compromised attackers began to publish packages with the malware. The malware intercepted cryptocurrency transactions within the browser, redirecting the transactions to the attacker's accounts.[41] [42]

September 2025 self-replicating worm

Also in September 2025, a self-replicating worm nicknamed Shai-Hulud appeared that steals GitHub developer credentials from affected systems to spread itself to other projects. As of September 16, the worm affected more than 187 packages.[43]

November 2025 token farms

In November 2025, Amazon Web Services researchers discovered over 150,000 packages hosted on npm that were connected to a Tea blockchain token farming campaign.[44] [45]

Alternatives

There are a number of open-source alternatives to npm for installing modular JavaScript, including pnpm, Yarn,[46] Bun and Deno. Deno and Bun also provide a JavaScript runtime, while only Deno operates independently from npm Registry or any centralized repository[47] and its support of npm registry is still a subject of ongoing work in progress as of January 2024.[48] They are all compatible with the public npm registry and use it by default, but provide different client-side experiences, usually focused on improving performance and determinism compared to the npm client.[49]

See also

Notes and References

  1. Web site: Microsoft-owned GitHub to acquire JavaScript package manager Npm. 17 March 2020. GeekWire.
  2. Web site: Earliest releases of npm . GitHub . 5 January 2019.
  3. Web site: Dierx. Peter. A Beginner's Guide to npm – the Node Package Manager. sitepoint. 22 July 2016. 30 March 2016.
  4. Web site: npm . npm . https://web.archive.org/web/20240514212833/https://www.npmjs.com/package/npm . 14 May 2024 . en . 15 May 2024.
  5. Web site: Ellingwood . Justin . How To Use npm to Manage Node.js Packages on a Linux Server . 22 October 2016 . DigitalOcean.
  6. Web site: npm-install . 22 October 2016 . docs.npmjs.
  7. Web site: semver . dead . https://web.archive.org/web/20161203095427/https://docs.npmjs.com/misc/semver . 3 December 2016 . 22 October 2016 . docs.npmjs.
  8. Web site: npm-version . 29 October 2016 . docs.npm.
  9. Web site: Koirala . Shivprasad . 21 August 2017 . What is the need of package-lock.json in Node? . codeproject.
  10. Web site: Turbak . Lyn . 2024 . Developing and Collaborating on React JS Apps . Wellesley College.
  11. Web site: Ampersand.js . Ampersand.js – Learn . 22 July 2016 . ampersandjs.com . 4 October 2016 . https://web.archive.org/web/20161004160210/https://ampersandjs.com/learn/npm-browserify-and-modules/ . dead .
  12. Web site: npm . 'npm audit': identify and fix insecure dependencies . 14 August 2018 . The npm Blog.
  13. Web site: npm . The Node Security Platform service is shutting down 9/30 . 14 August 2018 . The npm Blog .
  14. Book: Ojamaa . Andres . 2012 International Conference for Internet Technology and Secured Transactions . Duuna . Karl . 2012 . IEEE . 978-1-4673-5325-0 . Assessing the Security of Node.js Platform . 22 July 2016 . https://ieeexplore.ieee.org/document/6470829.
  15. Web site: npm Home . 2024-06-27 . npmjs.com . 13 April 2018 . https://web.archive.org/web/20180413130005/https://www.npmjs.com/ . dead .
  16. Web site: npm Code of Conduct: acceptable package content . 9 May 2017.
  17. Web site: Vorbach . Paul . npm-stat: download statistics for NPM packages . dead . https://web.archive.org/web/20160811014953/https://npm-stat.com/ . 11 August 2016 . 9 August 2016 . npm-stat.com.
  18. Web site: registry npm Docs . 2021-05-10 . docs.npmjs.com.
  19. Web site: Schlueter . Isaac Z. . Forget CommonJS. It's dead. We are server side JavaScript. . GitHub . 25 March 2013.
  20. Web site: npm/cli . GitHub.
  21. Web site: npm's New York Times Moment . npm Blog . 12 January 2010 . 27 September 2025.
  22. Web site: Chan . Rosalie . NPM Co-Founder and Chief Data Officer Laurie Voss Resigns . Business Insider . 30 June 2021.
  23. Web site: Chan . Rosalie . Bryan Bogensberger, CEO of JavaScript Package Startup NPM, Resigns . Business Insider . 30 June 2021.
  24. Web site: Chan . Rosalie . NPM Co-Founder and Chief Data Officer Laurie Voss Resigns . Business Insider . 30 June 2021.
  25. Web site: Friedman . Nat . npm is joining GitHub . The GitHub Blog . 16 March 2020 . 8 September 2025.
  26. News: Williams . Chris . How one developer just broke Node, Babel and thousands of projects in 11 lines of JavaScript . 17 April 2016 . The Register.
  27. Web site: Collins . Keith . 27 March 2016 . How one programmer broke the internet by deleting a tiny piece of code . 2020-12-23 . Quartz . en.
  28. Web site: Sharma . Ax . 27 July 2022 . Protestware on the rise: Why developers are sabotaging their own code . 11 May 2024 . TechCrunch.
  29. Web site: 24 March 2016 . How 17 Lines of Code Took Down Silicon Valley's Hottest Startups . 11 May 2024 . HuffPost . en.
  30. Web site: kik, left-pad, and npm . 9 May 2017.
  31. Web site: changes to unpublish policy . 23 January 2022 . npm Blog (Archive).
  32. Web site: Goodin . Dan . 26 November 2018 . Widely used open source software contained bitcoin-stealing backdoor . 11 May 2024 . Ars Technica . en-us.
  33. Web site: Claburn . Thomas . Check your repos... Crypto-coin-stealing code sneaks into fairly popular NPM lib (2m downloads per week) . 11 May 2024 . www.theregister.com . en.
  34. Web site: Sharma . Ax . 2 September 2021 . NPM package with 3million weekly downloads had a severe vulnerability . 11 May 2024 . Ars Technica . en-us.
  35. Web site: Claburn . Thomas . JavaScript library downloaded 3m times a week exposes apps to hijacking via evil proxy configs . 11 May 2024 . www.theregister.com . en.
  36. Web site: Dev corrupts NPM libs 'colors' and 'faker' breaking thousands of apps . 9 January 2022 . Bleeping Computer.
  37. Web site: BIG sabotage: Famous npm package deletes files to protest Ukraine war . 17 March 2022 . Bleeping Computer.
  38. Web site: Juha Saarinen . March 17, 2022 . 'Protestware' npm package dependency labelled supply-chain attack . IT News . nextmedia.
  39. Web site: Proven . Liam . 18 March 2022 . JavaScript library updated to wipe files from Russian computers . live . https://web.archive.org/web/20220318130958/https://www.theregister.com/2022/03/18/protestware_javascript_node_ipc/ . 18 March 2022 . 18 March 2022 . . Situation Publishing.
  40. Web site: Burt . Jeff . Hijacked S3 buckets used in attacks on npm packages . 11 May 2024 . www.theregister.com . en.
  41. Web site: npm debug and chalk packages compromised . 2025-09-08 . www.aikido.dev . en.
  42. Web site: npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack . 2025-09-08 . Socket . en-US.
  43. Web site: Self-Replicating Worm Hits 180+ Software Packages – Krebs on Security . Krebs on Security . 17 September 2025 . 16 September 2025.
  44. Web site: Lyons . Jessica . Crims flood npm with 150K+ junk packages to farm TEA tokens . . 2025-11-14 . 2025-11-17 . live . https://web.archive.org/web/20251115063548/https://www.theregister.com/2025/11/14/selfreplicating_supplychain_attack_poisons_150k/ . 2025-11-15.
  45. Web site: Tran . Chi . Bacon . Charlie . Amazon Inspector detects over 150,000 malicious packages linked to token farming campaign . . 2025-11-13 . 2025-11-17 . https://web.archive.org/web/20251117011112/https://aws.amazon.com/blogs/security/amazon-inspector-detects-over-150000-malicious-packages-linked-to-token-farming-campaign/ . live . 2025-11-17.
  46. Web site: Hello, Yarn!. 11 October 2016. The npm Blog. 17 December 2016.
  47. Web site: Managing Dependencies. Deno Docs. 6 Jan 2024.
  48. Web site: Node and npm modules Deno Docs . 2024-01-16 . docs.deno.com . en.
  49. Web site: Why I'm working on Yarn. 11 October 2016. 17 December 2016. Katz. Yehuda.