Node.js如何找npm模板

首先需要去官网下载npm文件

 https://www.npmjs.com/

下载完成,使用CD查看是否安装完成

然后就是贴代码看npm模板的功能

var _ = require('underscore');
_.each([1, 2, 3], function(num){
console.log("underscore.js says " + num);
});
 
使用Ctrl+S保存为JavaScript代码命名为foo.js
再使用终端安装 npm install underscore

最终使用   Node foo.js 成功输出结果

underscore.js says 1

underscore.js says 2

underscore.js says 3

 

猜你喜欢

转载自www.cnblogs.com/chaonuanxi/p/9375030.html