cellbang / cell

Cell is a Serverless First, componentized, platform-independent progressive application framework based on TypeScript. Cell 是基于 TypeScript 的 Serverless First、组件化、平台无关的渐进式应用框架。
https://malagu.naily.cc
MIT License
705 stars 62 forks source link

[bug] 使用malagu init初始化backend-app 404 #207

Closed cffycls closed 1 week ago

cffycls commented 6 months ago

【环境】win11,node18,pnpm 使用malagu init初始化backend-app,curl访问404,而不是预期的“Welcome to Malagu”。

malagu init backend-app
malagu serve

请求返回404

curl http://localhost:3000/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /</pre>
</body>
</html>
muxiangqiu commented 4 months ago
{
  "name": "backend-app",
  "keywords": [
    "malagu-component"
  ],
  "version": "0.0.0",
  "license": "MIT",
  "files": [
    "lib",
    "src"
  ],
  "dependencies": {
    "@malagu/core": "2.58.0",
    "@malagu/http": "2.58.0",
    "@malagu/web": "2.58.0",
    "@malagu/mvc": "2.58.0"
  },
  "devDependencies": {
    "@malagu/cli": "2.58.0",
    "@malagu/component": "2.58.0",
    "@malagu/testing": "2.58.0",
    "@types/supertest": "^2.0.12",
    "supertest": "^6.2.4"
  },
  "scripts": {
    "clean": "rimraf lib dist .malagu",
    "test": "malagu-component test",
    "build": "malagu build",
    "start": "malagu serve",
    "deploy": "malagu deploy -m scf -m test",
    "deploy:test": "malagu deploy -m scf -m test",
    "deploy:pre": "malagu deploy -m scf -m pre",
    "deploy:prod": "malagu deploy -m scf -m prod"
  }
}

在 pnpm 下,需要将间接依赖的 @malagu/xxx 显示声明出来。后面考虑兼容一下这种场景。

wwxiaoqi commented 3 months ago

根据快速开发指引:

npm install -g @malagu/cli
malagu init backend-app
cd backend-app
malagu serve

访问 localhost:3000 返回 Cannot GET /

$curl http://localhost:3000/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /</pre>
</body>
</html>

在 pnpm 下,需要将间接依赖的 @malagu/xxx 显示声明出来。后面考虑兼容一下这种场景。

好像不止是 pnpm 存在这种情况...

Update 1: image