Node.js如何找npm模板

Posted 超暖系呆少年i

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 

 

以上是关于Node.js如何找npm模板的主要内容,如果未能解决你的问题,请参考以下文章