首页 > 技术文章 > Node.js如何找npm模板

chaonuanxi 2018-07-26 23:09 原文

首先需要去官网下载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

 

 

推荐阅读