nodejs初始化init的示例代码
打开cmd创建即可
$npminit Packagename:(hello)//模块名字,npminit会自动取当前目录名作为默认名字,这里不需要改,直接确认即可 Description:Aexampleforwriteamodule//模块说明 Packageversion:(0.0.0)0.0.1//模块版本号,这个大家按自己习惯来定就可以 Projecthomepage:(none)//模块的主页,如果有的话可以填在这里,也可以不填 Projectgitrepository:(none)//模块的git仓库,选填。npm的用户一般都使用github做为自己的git仓库 Authorname:ElmerZhang//模块作者名字 Authoremail:(none)freeboy6716@gmail.com//模块作者邮箱 Authorurl:(none)http://www.elmerzhang.com//模块作者URL Mainmodule/entrypoint:(none)hello.js//模块的入口文件,我们这里是hello.js(这个必填) Testcommand:(none)//测试脚本,选填 Whatversionsofnodedoesitrunon?(~v0.5.7)*//依赖的node版本号,我们这个脚本可以运行在任何版本的node上,因此填* Abouttowriteto/home/elmer/hello/package.json //以下是生成的package.json文件内容预览 { "author":"ElmerZhang (http://www.elmerzhang.com)", "name":"hello", "description":"Aexampleforwriteamodule", "version":"0.0.1", "repository":{ "url":"" }, "main":"hello.js", "engines":{ "node":"*" }, "dependencies":{}, "devDependencies":{} } Isthisok?(yes)//对以上内容确认无误后,就可以直接回车确认了
以上这篇nodejs初始化init的示例代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。