您当前的位置: 首页 > 

罗四强

暂无认证

  • 1浏览

    0关注

    497博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

egg开发环境搭建

罗四强 发布时间:2022-01-26 23:34:25 ,浏览量:1

第一步:下载安装nodejs

下载官方网址:https://nodejs.org/en/download/ 本人是windows系统因此如图选择:

下载安装十分方便,环境变量也自动配置完成。node

第二步:eggjs环境搭配,建立运行项目

(注:nodejs版本最低要求 8.x,且须要LTS 版本)  egg官方文档网址:https://eggjs.org/zh-cn/生成项目: 1.npm i egg-init -g 2. egg-init egg-example --type=simple

如果报错,找不到egg-init这个命令,可以将以下目录加到环境变量

而后输入egg-init egg-example --type=simple(egg-example换成你本身要建立的项目名称)

以后设置名字,描述,做者等,想要快速看到效果可一路回车下一步。 3.cd egg-example  cd到新建立的项目目录下 4.npm i  安装项目的依赖:输入 npm i

启动项目:  1. npm run dev 或 npm start

PS F:\Data\eggProject\egg-example> npm start                                                                            npm WARN npm npm does not support Node.js v12.13.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/

> example@1.0.0 start F:\Data\eggProject\egg-example
> egg-scripts start --daemon --title=egg-server-example

[egg-scripts] Starting egg application at F:\Data\eggProject\egg-example
[egg-scripts] Run node --no-deprecation F:\Data\eggProject\egg-example\node_modules\egg-scripts\lib\start-cluster {"title":"egg-server-example","baseDir":"F:\\Data\\eggProject\\egg-example","framework":"F:\\Data\\eggProject\\egg-example\\node_modules\\egg"} --title=egg-server-example
[egg-scripts] Save log file to C:\Users\lex\logs
[egg-scripts] Wait Start: 1...
[egg-scripts] Wait Start: 2...
[egg-scripts] Wait Start: 3...
[egg-scripts] Wait Start: 4...
[egg-scripts] Wait Start: 5...
[egg-scripts] egg started on http://127.0.0.1:7001
PS F:\Data\eggProject\egg-example>    

 2.将图中的网址复制到浏览器中便可看到效果

http://127.0.0.1:7001

关注
打赏
1625533955
查看更多评论
立即登录/注册

微信扫码登录

0.1473s