Node.js是一个跨平台的服务器端JavaScript引擎,它可以运行在Windows、Linux、MacOS等多个操作系统上,并且可以与各种浏览器兼容,因此被广泛应用于Web开发领域。Node.js v18.14.1 是 Node.js 的一个版本,是对先前所发布的 Node.js 版本进行了更新和改进。以下是该版本中的一些主要功能和改进:
• 更新了 V8 JavaScript 引擎至 9.4 版本,提高了性能和稳定性。
• 更新了 npm 包管理器至 8.3.0 版本,增加了一些新特性如 npm workspaces 和 npm audit.
• 新增支持 crypto 模块内的 KeyObject 类,在处理密码学操作时会更加便利。
• 新增支持 -i, --interactive 命令选项,可将 REPL 界面转变为交互模式。
• 提升了自动化的 FIPS 模式 (Federal Information Processing Standards),以达到符合美国¥¥在安全性方面的标准。
Node.js 安装
1、安装编译环境,>sudo apt-get install g++ c++ curl libssl-dev apache2-utils git-core curl
2、下载Node安装包,>wget http://nodejs.org/dist/node-v0.3.0.tar.gz
3、编译安装,步骤如下:
>./configure //注:如果不需SSL,可加入选项-without-ssl
>make
>make install
4、安装成功,默认路径为:/usr/local/bin/node!
Node.js 应用
1、安装成功后先写“Hello World!”简单测试一下,代码如下:
Java代码
view plaincopy to clipboardprint?
//filename: app.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8000, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8000/');
2、运行 app.js,>node app.js,在浏览器输入http://127.0.0.1:8000/,即可看到效果
3、Node提供了一些常用的API,可参考:http://nodejs.org/api.html
NPM 安装
除Node本身提供的API外,现在有不少第三方模块可极大的提高开发效率,如:WEB框架-express,HTTP中间件-connect,模板-ejs等,为了管理这些模块我们需要安装NPM,安装过程如下:
1、首先准备目录权限,不要以ROOT帐号安装,>sudo chown -R $USER /usr/local
fedora下,先用root更改权限 chown -R $USER /usr/local 之后退出root
2、安装NPM,>curl http://npmjs.org/install.sh | sh
3、完成后安装第三方模块也很简单,>npm install modules_name,安装Express,>npm install express
注:如果安装模块的过程中报域名错误的话,请清空缓存 >npm cache clean 或重启计算机即可
值得关注的更新:
Build
FreeBSD 10 is no longer supported. #22617
child_process
The default value of the windowsHide option has been changed to true. #21316
console
console.countReset() will emit a warning if the timer being reset does not exist. #21649
console.time() will no longer reset a timer if it already exists. #20442
Dependencies
V8 has been updated to 7.0. #22754
fs
The fs.read() method now requires a callback. #22146
The previously deprecated fs.SyncWriteStream utility has been removed.#20735
http
The http, https, and tls modules now use the WHATWG URL parser by default. #20270
General
Use of process.binding() has been deprecated. Userland code using process.binding() should re-evaluate that use and begin migrating. If there are no supported API alternatives, please open an issue in the Node.js GitHub repository so that a suitable alternative may be discussed.
An experimental implementation of queueMicrotask() has been added. #22951
Internal
Windows performance-counter support has been removed. #22485
The --expose-http2 command-line option has been removed. #20887
Timers
Interval timers will be rescheduled even if previous interval threw an error. #20002
nextTick queue will be run after each immediate and timer. #22842
util
The WHATWG TextEncoder and TextDecoder are now globals. #22281
util.inspect() output size is limited to 128 MB by default. #22756
A runtime warning will be emitted when NODE_DEBUG is set for either http or http2. #21914
同类推荐
2024-05-13
立即下载
2023-11-02
立即下载
2023-11-02
立即下载
2023-08-07
立即下载
2023-08-06
立即下载
2023-07-21
立即下载相关文章
初学编程的软件_核桃编程 v1.4.3.0官方版
2020-07-01永久版Poedit Pro v2.3.0.5889文本代码编辑下载
2020-07-01Mercurial(分布式版本控制系统) v5.3官方版下载
2020-07-01编程软件visual c++6.0中文版下载_Visual C++6.0中文
2020-07-13visual studio 2010中文破解版下载
2020-09-01dwcc2019_Adobe Dreamweaver CC 2019中文破解版下载
2023-07-21coreldraw x7安装教程及破解版64位下载
2020-09-08CorelDRAW X7(图形设计软件)32位安装教程及破解版下载
2022-03-24CorelDRAW X4 平面设计软件 21.0.0.11_coreldraw x4安
2021-10-29coreldraw通用注册机激活_CorelDRAW Allversion KeyGe
2022-03-24
下载
2481下载
下载
下载
1129下载
1096下载
U盘装系统(http://www.upzxt.net) 版权所有 (网站邮箱:78435178@qq.com)
本站资源均收集与互联网,其著作权归原作者所有,如侵犯到您的权益的资源,请来信告知,我们及时撤销相应资源