This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: "Npm" – news · newspapers · books · scholar · JSTOR (June 2020) (Learn how and when to remove this message)

Original author(s)Isaac Z. Schlueter
Developer(s)npm, Inc. (a subsidiary of GitHub,[1] a subsidiary of Microsoft)
Initial release12 January 2010; 14 years ago (2010-01-12)[2]
Stable release
10.5.2[3] Edit this on Wikidata / 10 April 2024
Written inJavaScript
TypePackage manager
LicenseArtistic License 2.0

npm is a package manager for the JavaScript programming language maintained by Microsoft's npm, Inc. 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.[4]

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.


npm was developed by Isaac Z. Schlueter as a result of having "seen module packaging done terribly" and with inspiration from other similar projects such as PEAR (PHP) and CPAN (Perl).[5] npm is a JavaScript replacement for pm, a shell script.[6]

In March 2020 it was announced that npm is to be acquired by GitHub.[1]


npm can manage packages that are local dependencies of a particular project, as well as globally-installed JavaScript tools.[7] 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.[8] 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.[9] npm also provides version-bumping tools for developers to tag their packages with a particular version.[10] npm also provides the package-lock.json[11] file which has the entry of the exact version used by the project after evaluating semantic versioning in package.json.


npm's command-line interface client allows users to consume and distribute JavaScript modules that are available in the registry.[12]

In February 2018, an issue was discovered in version 5.7.0 in which running sudo npm on Linux systems would change the ownership of system files, permanently breaking the operating system.[13]

In npm version 6, the audit feature was introduced to help developers identify and fix security vulnerabilities in installed packages.[14] 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.[15]


Packages in the registry are in ECMAScript Module (ESM) or CommonJS format and include a metadata file in JSON format.[16]

Over 1.3 million packages are available in the main npm registry.[17]

The registry does not have any vetting process for submission, which means that packages found there can potentially be low quality, insecure, or malicious.[16] Instead, npm relies on user reports to take down packages if they violate policies by being low quality, insecure, or malicious.[18] npm exposes statistics including number of downloads and number of depending packages to assist developers in judging the quality of packages.[19]

Internally npm relies on the NoSQL Couch DB to manage publicly available data.[20]

Security and disruption


Main article: 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.[21][22] The package was immensely popular on the platform, being depended on by thousands of projects and reaching 15 million downloads prior to its removal.[21][23] Several projects critical to the JavaScript ecosystem including Babel and Webpack depended on left-pad and were rendered unusable.[24] Although the package was republished three hours later,[25] it caused widespread disruption, leading npm to change its policies regarding unpublishing to prevent a similar event in the future.[26]


Main article: 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 became affected by the malicious package if the dependency was fetched as the latest package.[27][28] The affected dependency was also briefly present in version 3.1 of Unity Hub; a hotfix was released the same day to remove the issue, however.[29]

Other notable incidents

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.[30] The malicious package, called flatmap-stream, contained an encrypted payload that stole bitcoins from certain applications.[31]

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

In January 2022, the maintainer of the popular package colors pushed changes printing garbage text in an infinite loop.[23] 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?"[34]

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.[35]


There are a number of open-source alternatives to npm for installing modular JavaScript, including Yarn,[36] Bun and Deno. Deno and Bun also provide a JavaScript runtime, while only Deno operates independently from NPM Registry or any centralized repository[37] and its support of NPM registry is still a subject of ongoing work in progress as of January 2024.[38] 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.[39]

See also


  1. ^ a b "Microsoft-owned GitHub to acquire JavaScript package manager Npm". GeekWire. 17 March 2020.
  2. ^ "Earliest releases of npm". GitHub. Retrieved 5 January 2019.
  3. ^ "Release 10.5.2". 10 April 2024. Retrieved 23 April 2024.
  4. ^ Dierx, Peter (30 March 2016). "A Beginner's Guide to npm – the Node Package Manager". sitepoint. Retrieved 22 July 2016.
  5. ^ Schlueter, Isaac Z. (25 March 2013). "Forget CommonJS. It's dead. **We are server side JavaScript.**". GitHub.
  6. ^ "NPM/Cli". GitHub.
  7. ^ Ellingwood, Justin. "How To Use npm to Manage Node.js Packages on a Linux Server". DigitalOcean. Retrieved 22 October 2016.
  8. ^ "npm-install". docs.npmjs. Retrieved 22 October 2016.
  9. ^ "semver". docs.npmjs. Archived from the original on 3 December 2016. Retrieved 22 October 2016.
  10. ^ "npm-version". docs.npm. Retrieved 29 October 2016.
  11. ^ Koirala, Shivprasad (21 August 2017). "What is the need of package-lock.json in Node?". codeproject.
  12. ^ Ampersand.js. "Ampersand.js – Learn". Retrieved 22 July 2016.
  13. ^ "Critical Linux filesystem permissions are being changed by latest version". GitHub. Retrieved 25 February 2018.
  14. ^ npm. "'npm audit': identify and fix insecure dependencies". The npm Blog. Retrieved 14 August 2018.
  15. ^ npm. "The Node Security Platform service is shutting down 9/30". The npm Blog. Retrieved 14 August 2018.
  16. ^ a b Ojamaa, Andres; Duuna, Karl (2012). "Assessing the Security of Node.js Platform". 2012 International Conference for Internet Technology and Secured Transactions. IEEE. ISBN 978-1-4673-5325-0. Retrieved 22 July 2016.
  17. ^ Nassri, Ahmad (14 April 2020). "So long, and thanks for all the packages!". The npm Blog. Retrieved 6 January 2021.
  18. ^ "npm Code of Conduct: acceptable package content". Retrieved 9 May 2017.
  19. ^ Vorbach, Paul. "npm-stat: download statistics for NPM packages".
  20. ^ "registry | npm Docs". Retrieved 10 May 2021.
  21. ^ a b Williams, Chris. "How one developer just broke Node, Babel and thousands of projects in 11 lines of JavaScript". The Register. Retrieved 17 April 2016.
  22. ^ Collins, Keith (27 March 2016). "How one programmer broke the internet by deleting a tiny piece of code". Quartz. Retrieved 23 December 2020.
  23. ^ a b Sharma, Ax (27 July 2022). "Protestware on the rise: Why developers are sabotaging their own code". TechCrunch. Retrieved 11 May 2024.
  24. ^ "How 17 Lines of Code Took Down Silicon Valley's Hottest Startups". HuffPost. 24 March 2016. Retrieved 11 May 2024.
  25. ^ "kik, left-pad, and npm". Retrieved 9 May 2017.
  26. ^ "changes to unpublish policy". npm Blog (Archive). Retrieved 23 January 2022.
  27. ^ "BIG sabotage: Famous npm package deletes files to protest Ukraine war". Bleeping Computer. Retrieved 17 March 2022.
  28. ^ Juha Saarinen (17 March 2022). "'Protestware' npm package dependency labelled supply-chain attack". IT News. nextmedia.
  29. ^ Proven, Liam (18 March 2022). "JavaScript library updated to wipe files from Russian computers". The Register. Situation Publishing. Archived from the original on 18 March 2022. Retrieved 18 March 2022.
  30. ^ Goodin, Dan (26 November 2018). "Widely used open source software contained bitcoin-stealing backdoor". Ars Technica. Retrieved 11 May 2024.
  31. ^ Claburn, Thomas. "Check your repos... Crypto-coin-stealing code sneaks into fairly popular NPM lib (2m downloads per week)". Retrieved 11 May 2024.
  32. ^ Sharma, Ax (2 September 2021). "NPM package with 3 million weekly downloads had a severe vulnerability". Ars Technica. Retrieved 11 May 2024.
  33. ^ Claburn, Thomas. "JavaScript library downloaded 3m times a week exposes apps to hijacking via evil proxy configs". Retrieved 11 May 2024.
  34. ^ "Dev corrupts NPM libs 'colors' and 'faker' breaking thousands of apps". Bleeping Computer. Retrieved 9 January 2022.
  35. ^ Burt, Jeff. "Hijacked S3 buckets used in attacks on npm packages". Retrieved 11 May 2024.
  36. ^ "Hello, Yarn!". The npm Blog. 11 October 2016. Retrieved 17 December 2016.
  37. ^ "Managing Dependencies". Deno Docs. Retrieved 6 January 2024.
  38. ^ "Node and npm modules | Deno Docs". Retrieved 16 January 2024.
  39. ^ Katz, Yehuda (11 October 2016). "Why I'm working on Yarn". Retrieved 17 December 2016.