nodejs初始化init的示例代码

打开cmd创建即可

$ npm init Package name: (hello) //模块名字,npm init会自动取当前目录名作为默认名字,这里不需要改,直接确认即可 Description: A example for write a module //模块说明 Package version: (0.0.0) 0.0.1 //模块版本号,这个大家按自己习惯来定就可以 Project homepage: (none) //模块的主页,如果有的话可以填在这里,也可以不填 Project git repository: (none) //模块的git仓库,选填。npm的用户一般都使用github做为自己的git仓库 Author name: Elmer Zhang //模块作者名字 Author email: (none) freeboy6716@gmail.com //模块作者邮箱 Author url: (none) //模块作者URL Main module/entry point: (none) hello.js //模块的入口文件,我们这里是hello.js </span><span>(这个必填)</span><span> Test command: (none) //测试脚本,选填 What versions of node does it run on? (~v0.5.7) * //依赖的node版本号,我们这个脚本可以运行在任何版本的node上,因此填 * About to write to /home/elmer/hello/package.json // 以下是生成的package.json文件内容预览 { "author": "Elmer Zhang <freeboy6716@gmail.com> ()", "name": "hello", "description": "A example for write a module", "version": "0.0.1", "repository": { "url": "" }, "main": "hello.js", "engines": { "node": "*" }, "dependencies": {}, "devDependencies": {} } Is this ok? (yes) //对以上内容确认无误后,就可以直接回车确认了

以上这篇nodejs初始化init的示例代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1a94a2c7947bd0eae8a7cc881772f64f.html