egg.js初始化问题
环境
node版本8.9.0,全局安装了egg-init
操作步骤
我是按照文档走以下命令
$ mkdir egg-example && cd egg-example
$ npm init egg --type=simple
得到的是一个没有依赖和script的package.json。
{
"name": "egg",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": ""
}
请问正确的初始化姿势是?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
直接用egg-init而不是npm init egg
查看npm文档,原来还有这种用法:
它会把initializer和create按一定规则拼接,然后交给npx调用,如下:
npm init foo
->npx create-foo
npm init @usr/foo
->npx @usr/create-foo
npm init @usr
->npx @usr/create
并且--参数会交由拼接好的模块调用。所以
npm init egg --type=simple
相当于npx create-egg --type=simple
。注: create-egg是egg-init的别名包