文章加密

;

2019年11月13日 星期三

Node.js v.s. npm / runtime

Short ver
Node.js runtime basically what will understand your javascript code and execute it to produce a result.
npm package manager 管理各種第三方插件和版本號

Node JS
  • Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.
  • Real-Time services (Chat, Games etc)
NPM
  • Npm is a package manager. Typically this software is installed to build Node applications.
  • It let's you install software (libraries, plugins, frameworks and applications).
(題外話: npm i <package name> 在 NPM version 5 之後已經與npm i <package name> --save相同)

Detailed ver 
Node and npm perform different functions, have different sponsors, and operate under different governance models.Different FunctionsNode is a runtime. The npm command line utility runs on the Node.js runtime.
Npm is actually more than just a command line utility. It is also a registry. The npm registry is, in the most basic form, a huge CouchDB database containing data for ~1M modules. These are the modules you download whenever running “npm install”.
Different Sponsors
Running this registry(版本號) is expensive, so Npm, Inc was formed to support it.
Node used to be built at Joyent, who employed Ryan Dahl (Node’s creator). The community rejected the concept of a corporate entity being in control of the runtime, ultimately separating from Joyent.
Different Governance Models
Npm is a for-profit company.
Node is now developed under an open authority model, via the Node Foundation/JS Foundation (part of the Linux Foundation). There are many corporate sponsors with members who make up the committees, but there are also many working groups who help make decisions about different aspects of Node.js. These working groups consist of individuals who aren’t employed by the big tech firms. I’m an example… I’m a member of the version management working group.


and ...

Node is a runtime environment for JavaScript based on Google's V8 interpreter. In that regard it is similar to Zend PHP, OpenJDK, etc. NPM is a package manager for Node — just like it says on the tin: Node Package Manager. In the regard it's similar to Composer, Maven, Pip, etc.


What is Runtime?
Runtime describes software/instructions that are executed while your program is running, especially those instructions that you did not write explicitly, but are necessary for the proper execution of your code.
Low-level languages like C have very small (if any) runtime. More complex languages like Objective-C, which allows for dynamic message passing, have a much more extensive runtime.
You are correct that runtime code is library code, but library code is a more general term, describing the code produced by any library. Runtime code is specifically the code required to implement the features of the language itself.

沒有留言:

張貼留言