Content deleted Content added
AdaHephais (talk | contribs) Internal link Tags: Visual edit Mobile edit Mobile web edit Advanced mobile edit |
I like this better |
||
(38 intermediate revisions by 32 users not shown) | |||
Line 1:
{{short description|JavaScript runtime environment}}
{{Use dmy dates|date=November 2019}}▼
{{Use American English|date=May 2025}}
{{Infobox software
| name = Node.js
Line 14 ⟶ 16:
}}
'''Node.js''' is a [[cross-platform]], [[Open-source software|open-source]] [[JavaScript]] [[
Node.js lets developers use JavaScript to write [[Command-line interface|command line tools]] and
Node.js has an [[event-driven architecture]] capable of [[asynchronous I/O]]. These design choices aim to optimize [[throughput]] and [[scalability]] in web applications with many input/output operations, as well as for [[real-time Web]] applications (e.g., [[real-time communication]] programs and [[browser game]]s).<ref name="readwrite">{{cite web |author=Laurent Orsini |date=2013-11-07 |title=What You Need To Know About Node.js |url=http://readwrite.com/2013/11/07/what-you-need-to-know-about-nodejs |access-date=2022-02-06 |website=readwrite.com}}</ref>
Line 29 ⟶ 31:
Dahl criticized the limited capability of [[Apache HTTP Server]] to handle many (10,000+) concurrent connections, as well as the dominant programming paradigm of sequential programming, in which applications could block entire processes or cause the creation of multiple execution stacks for simultaneous connections.<ref>{{cite web |last=Garbar |first=Dzmitry |title=PHP 7 vs Node.js? They Can Be Partners, Not Competitors For a Developer! |url=https://belitsoft.com/php-development-services/php7-vs-nodejs |access-date=21 December 2016 |website=belitsoft.com}}</ref>
Dahl demonstrated the project at the inaugural European JSConf on November 8, 2009.<ref name="b3">[https://books.google.com/books?id=KGt-FxUEj48C&dq=nodejs&pg=PT24 Sams Teach Yourself Node.js in 24 Hours], Sams Publishing, 05-Sep-2012</ref><ref>{{Cite web |last=Ubl |first=Malte |date=2009-09-09 |title=JSConf.eu 2009, Berlin, Germany |url=https://www.jsconf.eu/2009/speaker/speakers_selected.html |access-date=2009-09-09 |website=www.jsconf.eu}}</ref><ref>{{Cite web|url=https://www.youtube.com/watch?v=ztspvPYybIY |archive-url=https://ghostarchive.org/varchive/youtube/20211215/ztspvPYybIY |archive-date=2021-12-15 |url-status=live|title=Ryan Dahl: Original Node.js presentation|date=8 June 2012 |via=www.youtube.com}}{{cbignore}}</ref> Node.js combined [[Google]]'s [[Chrome V8|V8]] JavaScript engine, an [[event loop]], and a low-level [[Input/output|I/O]] [[Application programming interface|API]].<ref name="b1">[https://books.google.com/books?id=ZH6bpbcrlvYC&q=nodejs Professional Node.js: Building JavaScript Based Scalable Software], John Wiley & Sons, 01-Oct-2012</ref>
In January 2010, a [[package manager]] was introduced for the Node.js environment called [[Npm (software)|npm]].<ref>{{cite web |url=https://github.com/npm/npm/releases?after=v0.1.1 |title=Earliest releases of npm |website=GitHub |access-date = 27 July 2016}}</ref> The package manager allows programmers to publish and share Node.js [[Package manager|packages]], along with the accompanying source code, and is designed to simplify the installation, update and uninstallation of packages.<ref name="b1"/>
In June 2011, Microsoft and Joyent implemented a native [[Microsoft Windows|Windows]] version of Node.js.<ref>{{cite web |last=Ryandahl |date=2011-06-23 |title=Porting Node to Windows With Microsoft's Help |url=https://nodejs.org/en/blog/uncategorized/porting-node-to-windows-with-microsofts-help/ |access-date=17 April 2016 |website=nodejs.org}}</ref> The first Node.js build supporting Windows was released in July 2011.
Line 42 ⟶ 44:
In 2019, the JS Foundation and Node.js Foundation merged to form the [[OpenJS Foundation]].
===Branding===
Line 53:
JavaScript is the only language that Node.js supports natively, but many [[Source-to-source compiler|compile-to-JS]] languages are available.<ref>{{Cite web|url=https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js|title=List of languages that compile to JS|website=Github}}</ref> As a result, Node.js applications can be written in [[CoffeeScript]],<ref name="b6">{{cite book |url=https://books.google.com/books?id=Oda-MgEACAAJ&q=nodejs |title=CoffeeScript on Node.js |publisher=O'Reilly Media, Inc. |date=15 April 2013 |access-date = 17 May 2015|isbn=9781449316846 }}</ref> [[Dart (programming language)|Dart]], [[TypeScript]], [[ClojureScript]] and others.
Node.js is primarily used to build network programs such as web servers.<ref name="b2">[https://books.google.com/books?id=KZQQAlhTOBgC&q=nodejs Node.js for PHP Developers], O'Reilly Media, Inc., 2013</ref> The most significant difference between Node.js and [[PHP]] is that most functions in PHP [[Asynchronous I/O|block]] until completion (commands execute only after previous commands finish), while Node.js functions are [[Asynchronous I/O|non-blocking]] (commands execute [[Concurrent computing|concurrently]]
Node.js is officially supported by [[Linux]], {{nowrap|[[macOS]]}} and [[Microsoft Windows]] 8.1 and Server 2012 (and later),<ref name="supportedOS" /> with Tier 2 support for [[SmartOS]] and [[IBM AIX]] and experimental support for [[FreeBSD]]. [[OpenBSD]] also works, and LTS versions are available for [[IBM i]] (AS/400).<ref>{{Cite web |last=Foundation |first=Node js |title=Installing Node.js via package manager |url=https://nodejs.org/en/download/package-manager/ |access-date=2019-05-19 |website=Node.js |language=en}}</ref> The source code may also be built on similar operating systems that are not officially supported, such as [[NonStop OS]]<ref name="bomBora - Node.js for NonStop">{{cite web |title=bomBora - Node.js for NonStop |url=http://infrasoft.com.au/bomBora.html |access-date=14 August 2015 |website=infrasoft.com.au |publisher=Infrasoft |archive-date=11 March 2018 |archive-url=https://web.archive.org/web/20180311040354/http://infrasoft.com.au/bomBora.html |url-status=dead }}</ref> and [[Unix]] servers.
Line 63:
=== Industry support ===
There are thousands of open-source libraries for Node.js, most of which are hosted on the npm website. Multiple developer conferences and events are held that support the Node.js community, including NodeConf, Node Interactive, and Node Summit, as well as a number of regional events.
The open-source community has developed [[web framework]]s to accelerate the development of applications. Such frameworks include [[Express.js]], [[Socket.IO]], [[Sails.js]], [[Next.js]] and [[Meteor (web framework)|Meteor]].<ref name="b1"/><ref name="b7">[https://books.google.com/books?id=5eGRAwAAQBAJ&q=nodejs Express.js Guide: The Comprehensive Book on Express.js], Azat Mardan, 28-May-2014</ref> Various packages have also been created for interfacing with other languages or runtime environments such as [[Microsoft .NET]].<ref>[http://www.techrepublic.com/article/edge-js-bridges-the-gap-between-node-js-and-net/ Edge.js bridges the gap between Node.js and .NET], TechRepublic, Tony Patton, 1 July 2014</ref>
Modern desktop [[integrated development environment|IDEs]] provide editing and debugging features specifically for Node.js applications. Such IDEs include [[Atom (text editor)|Atom]], [[Brackets (text editor)|Brackets]], [[JetBrains MPS|JetBrains]] [[WebStorm]],<ref>[https://www.jetbrains.com/webstorm/help/node-js.html Node.js], WebStorm supports integration with the Node.js runtime environment, WebStorm Help</ref><ref>[https://www.jetbrains.com/webstorm/help/running-and-debugging-node-js.html Running and Debugging Node.js], WebStorm Help</ref> [[Microsoft Visual Studio]] (with Node.js Tools for Visual Studio,<ref>{{cite web |title=Node.js Tools for Visual Studio |url=https://www.visualstudio.com/en-us/features/node-js-vs.aspx |access-date=1 Feb 2016 |website=microsoft.com}}</ref> or [[TypeScript]] with Node definitions<ref>[https://github.com/soywiz/typescript-node-definitions soywiz/typescript-node-definitions TypeScript's typings for some popular node.js modules], GitHub</ref><ref>[https://github.com/DefinitelyTyped/DefinitelyTyped DefinitelyTyped], GitHub</ref><ref>{{Cite web|url=http://definitelytyped.org/|archiveurl=https://web.archive.org/web/20160203083254/http://definitelytyped.org/|url-status=dead|title=The repository for high quality TypeScript type definitions|archivedate=3 February 2016|website=definitelytyped.org}}</ref><ref>[https://www.typescriptlang.org/Samples#ImageBoard ImageBoard, A Node.js + Express + MongoDB application built using TypeScript on the server] {{Webarchive|url=https://web.archive.org/web/20190518111659/http://www.typescriptlang.org/samples/#ImageBoard |date=18 May 2019 }}, TypeScript Samples</ref>), [[NetBeans]],<ref>{{cite web |last=Krill |first=Paul |date=2015-11-10 |title=Node.js takes center stage in NetBeans 8.1 |url=http://www.infoworld.com/article/3003414/java/nodejs-takes-center-stage-in-netbeans-81.html |access-date=2015-11-10 |website=infoworld.com |publisher=[[InfoWorld]]}}</ref> Nodeclipse Enide Studio<ref>{{usurped|1=[https://web.archive.org/web/20120508061750/http://www.nodeclipse.org/ Nodeclipse, Enide -- Node.JS development in Eclipse]}}, Nodeclipse Website</ref> ([[Eclipse (software)|Eclipse]]-based) and [[Visual Studio Code]].<ref>[https://channel9.msdn.com/Blogs/cloud-with-a-silver-lining/hello-visual-studio-code-nodejs Hello Visual Studio Code (with NodeJS)], Channel 9, Microsoft
</ref><ref>
[https://code.visualstudio.com/Docs/runtimes/nodejs Node.js Applications with VS Code], Visual Studio Code
Line 179:
| 2022-06-01
|-
| {{Version|
| {{Version|
|Hydrogen<ref name="Release" />
| 2022-04-19
Line 192:
|-
| {{Version|co|20.x}}
| {{Version|co|
| Iron<ref name="Codenames">{{cite web |title=Node.JS CODENAMES.md |url=https://github.com/nodejs/Release/blob/main/CODENAMES.md |access-date=6 September 2023 |website=GitHub |language=en}}</ref>
| 2023-04-18
| 2026-04-30
|-
| {{Version|
| {{Version|
| <ref name="Release" />
| 2023-10-17
Line 205:
|-
| {{Version|c|22.x}}
| {{Version|c|
| Jod <ref name="Codenames" /><ref name="Release" />
| 2024-04-24
Line 211:
|-
|-
| {{Version|
| {{Version|
| <ref name="Release" />
| 2024-10-
| 2025-06-01
|-
|-
| {{Version|
| {{Version|
| Krypton <ref name="Codenames" />
| 2025-04-22
| 2028-04-30
|-
|-▼
| colspan="5" | <small>{{Version |l |show=111101}}</small>▼
| {{Version|p|26.x}}
| {{Version|p|Planned}}
| Lithium<ref name="Codenames" />
| 2026
| 2029
|-▼
|-
| {{Version|p|28.x}}
| {{Version|p|Planned}}
| Magnesium <ref name="Codenames" />
| 2027
| 2030
|-
|-
| {{Version|p|30.x}}
| {{Version|p|Planned}}
| Neon<ref name="Codenames" />
| 2028
| 2031
|-
|-
| {{Version|p|32.x}}
| {{Version|p|Planned}}
| Oxygen<ref name="Codenames" />
| 2029
| 2032
|-
|-
| {{Version|p|34.x}}
| {{Version|p|Planned}}
| Platinum<ref name="Codenames" />
| 2030
| 2033
|-
|}
New major releases of Node.js are cut from the [[GitHub]] main branch every six months. Even-numbered versions are cut in April and odd-numbered versions are cut in October. When a new odd version is released, the previous even version undergoes transition to [[Long-term support|Long Term Support]] (LTS), which gives that version
▲New major releases of Node.js are cut from the [[GitHub]] main branch every six months. Even-numbered versions are cut in April and odd-numbered versions are cut in October. When a new odd version is released, the previous even version undergoes transition to [[Long-term support|Long Term Support]] (LTS), which gives that version 18 months of active support from the date it is designated LTS. After these 18 months expire, an LTS release receives an additional 12 months of maintenance support. An active version receives non-breaking backports of changes a few weeks after they land in the current release. A maintenance release receives only critical fixes and documentation updates.<ref name="Release">{{Cite web|url=https://github.com/nodejs/Release|title=nodejs/Release|website=GitHub|language=en|access-date=2018-05-03}}</ref> The LTS Working Group manages strategy and policy in collaboration with the Technical Steering Committee of the Node.js Foundation.
== Technical details ==
Line 233 ⟶ 267:
=== Internals ===
Node.js uses [[libuv]] under the hood to handle asynchronous events. Libuv is an abstraction layer for network and file system functionality on both Windows and [[POSIX]]-based systems such as Linux, [[macOS]], OSS on [[NonStop (server computers)|NonStop]], and Unix. Node.js relies on
=== Threading ===
Node.js operates on a [[Single threading|single-thread]] [[event loop]], using [[non-blocking I/O]] calls, allowing it to support tens of thousands of concurrent connections without incurring the cost of thread [[context switch]]ing.<ref>{{cite web|url=http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/|title=Node.js w/1M concurrent connections!|work=caustik's blog|date=19 August 2012}}</ref> The design of sharing a single thread among all the requests that use the [[observer pattern]] is intended for building highly concurrent applications, where any function performing I/O must use a [[Callback (computer programming)|callback]]. To accommodate the single-threaded event loop, Node.js uses the [[libuv]] library—which, in turn, uses a fixed-sized thread pool that handles some of the non-blocking asynchronous I/O operations.<ref name="readwrite" />
Line 239 ⟶ 274:
A thread pool handles the execution of parallel tasks in Node.js. The main thread function call posts tasks to the shared task queue, which threads in the thread pool pull and execute. Inherently non-blocking system functions such as networking translate to kernel-side non-blocking sockets, while inherently blocking system functions such as file I/O run in a blocking way on their own threads. When a thread in the thread pool completes a task, it informs the main thread of this, which in turn, wakes up and executes the registered callback.
A downside of this single-threaded approach is that Node.js does not allow [[vertical scaling]] by increasing the number of [[CPU core]]s of the machine it is running on without using an additional module, such as cluster,<ref name="node_cluster_module_doc">{{cite web |title=Node.js's cluster module |url=https://nodejs.org/api/cluster.html |access-date=19 October 2017 |website=nodejs.org}}</ref> StrongLoop Process Manager,<ref>{{Cite web|url=http://strong-pm.io/|title=StrongLoop Process Manager|website=strong-pm.io}}</ref> or pm2.<ref>{{cite web|url=https://github.com/Unitech/pm2|title=GitHub - Unitech/pm2: Production process manager for Node.js applications with a built-in load balancer|work=GitHub|date=12 June 2021}}</ref> However, developers can increase the default number of threads in the libuv thread pool. The server [[operating system|operating system (OS)]] is likely to distribute these threads across multiple cores.<ref>{{cite web|url=http://www.future-processing.pl/blog/on-problems-with-threads-in-node-js/|title=On problems with threads in node.js - Future Processing|author=Aleksander Kasiuk|date=22 April 2015}}</ref> Another problem is that long-lasting computations and other CPU-bound tasks freeze the entire event-loop until completion.{{citation needed|date=March 2017}}
=== V8 ===
Line 246 ⟶ 281:
=== Package management ===
[[npm (software)|npm]] is the pre-installed package manager for the Node.js server platform. It installs Node.js programs from the
=== Event loop ===
Line 278 ⟶ 313:
| aduh95 || Antoine du Hamel
|-
| anonrig || Yagiz Nizipli
|-
| benjamingr || Benjamin Gruenbaum
|-
| BridgeAR || Ruben Bridgewater
▲|-
|-
| gireeshpunathil || Gireesh Punathil
Line 299 ⟶ 332:
|-
| mhdawson || Michael Dawson
▲|-
|-
| RafaelGSS || Rafael Gonzaga
Line 316 ⟶ 347:
| tniessen || Tobias Nießen
|}
==References==
Line 331 ⟶ 361:
{{Commons category}}
* {{Official website}}
{{NodeJs}}
{{JavaScript}}
{{Authority control}}
▲{{Use dmy dates|date=November 2019}}
[[Category:2009 software]]
|