ice 路由报错

yquaqz18  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(41)

Describe the bug

按照官网的配置,访问路由报错
PipeToResponse onShellError, downgrade to CSR.
Error: Route "login/index" has no component! Please go add a default export in the route module file.

Expected behavior

PipeToResponse onShellError, downgrade to CSR.
Error: Route "login/index" has no component! Please go add a default export in the route module file.

Actual behavior

PipeToResponse error.
Error: Route "login/index" has no component! Please go add a default export in the route module file.
If you were trying to navigate or submit to a resource route, use <a> instead of <Link> or <Form reloadDocument> .
at RouteComponent (file:///D:/reactProject/sso-app/node_modules/@ice/runtime/esm/routes.js:126:19)
at renderWithHooks (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5724:16)
at renderIndeterminateComponent (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5797:15)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
at renderNodeDestructiveImpl (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderIndeterminateComponent (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5851:7)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
PipeToResponse onShellError, downgrade to CSR.
Error: Route "login/index" has no component! Please go add a default export in the route module file.
If you were trying to navigate or submit to a resource route, use <a> instead of <Link> or <Form reloadDocument> .
at RouteComponent (file:///D:/reactProject/sso-app/node_modules/@ice/runtime/esm/routes.js:126:19)
at renderWithHooks (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5724:16)
at renderIndeterminateComponent (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5797:15)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
at renderNodeDestructiveImpl (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderIndeterminateComponent (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5851:7)
at renderElement (D:\reactProject\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
webpack 5.76.2 compiled successfully in 598 ms
webpack 5.76.2 compiled successfully in 146 ms

Version of ice.js

3.0

Content of build.json or ice.config.mts

import { defineConfig } from '@ice/app';

// The project config, see https://v3.ice.work/docs/guide/basic/config
const minify = process.env.NODE_ENV === 'production' ? 'swc' : false;
export default defineConfig(() => ({
  // Set your configs here.
  minify,
  server: {
    onDemand: true,
    format: 'esm',
  },
}));

Additional context

No response

mkh04yzy

mkh04yzy1#

Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:' 21:42:01

at __node_internal_captureLargerStackTrace (node:internal/errors:477:5)
at new NodeError (node:internal/errors:387:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1116:11)
at defaultResolve (node:internal/modules/esm/resolve:1196:3)
at nextResolve (node:internal/modules/esm/loader:165:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
at ESMLoader.import (node:internal/modules/esm/loader:528:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at ServerRunner.interopedImport (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:181:32)
at ServerRunner.requestModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:105:40)
at async ServerRunner.cachedRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:42:20)
at async ServerRunner.dependencyRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:87:20)
at async src\pages\index.tsx:8:26
at async ServerRunner.requestModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:171:9)
at async ServerRunner.cachedRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:42:20)
at async ServerRunner.dependencyRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:87:20)
at async loadRouteModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:25:29)
at async loadRouteModules (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:37:29)
at async doRender (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/runServerApp.js:166:30)
at async Module.renderToResponse (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/runServerApp.js:71:20)

ERROR Cannot read properties of undefined (reading 'Button') 21:42:01

at src\pages\index.tsx:9:33
at async ServerRunner.requestModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:171:9)
at async ServerRunner.cachedRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:42:20)
at async ServerRunner.dependencyRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:87:20)
at async loadRouteModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:25:29)
at async loadRouteModules (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:37:29)
at async doRender (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/runServerApp.js:166:30)
at async Module.renderToResponse (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/runServerApp.js:71:20)

PipeToResponse error.
Error: Route "index" has no component! Please go add a default export in the route module file.
If you were trying to navigate or submit to a resource route, use <a> instead of <Link> or <Form reloadDocument> .
at RouteComponent (file:///E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:126:19)
at renderWithHooks (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5724:16)
at renderIndeterminateComponent (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5797:15)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
at renderNodeDestructiveImpl (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderIndeterminateComponent (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5851:7)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
PipeToResponse onShellError, downgrade to CSR.
Error: Route "index" has no component! Please go add a default export in the route module file.
If you were trying to navigate or submit to a resource route, use <a> instead of <Link> or <Form reloadDocument> .
at RouteComponent (file:///E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:126:19)
at renderWithHooks (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5724:16)
at renderIndeterminateComponent (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5797:15)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
at renderNodeDestructiveImpl (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderContextProvider (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5986:3)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6083:11)
at renderNodeDestructiveImpl (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6170:11)
at renderNodeDestructive (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6142:14)
at renderIndeterminateComponent (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:5851:7)
at renderElement (E:\reactProject\sso-app2\sso-app\node_modules\react-dom\cjs\react-dom-server.node.development.js:6012:7)
PS E:\reactProject\sso-app2\sso-app> npm run start
start
ice start

webpack 5.76.2 compiled successfully in 2353 ms
21:42:16
Starting the development server at:

- Local  : http://localhost:3000/
- Network: http://192.168.101.1:3000/

ERROR Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:' 21:42:16

at __node_internal_captureLargerStackTrace (node:internal/errors:477:5)
at new NodeError (node:internal/errors:387:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1116:11)
at defaultResolve (node:internal/modules/esm/resolve:1196:3)
at nextResolve (node:internal/modules/esm/loader:165:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
at ESMLoader.import (node:internal/modules/esm/loader:528:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at ServerRunner.interopedImport (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:181:32)
at ServerRunner.requestModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:105:40)
at async ServerRunner.cachedRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:42:20)
at async ServerRunner.dependencyRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:87:20)
at async src\pages\index.tsx:8:26
at async ServerRunner.requestModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:171:9)
at async ServerRunner.cachedRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:42:20)
at async ServerRunner.dependencyRequest (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/app/esm/service/Runner.js:87:20)
at async loadRouteModule (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:25:29)
at async loadRouteModules (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/routes.js:37:29)
at async doRender (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/runServerApp.js:166:30)
at async Module.renderToResponse (/E:/reactProject/sso-app2/sso-app/node_modules/@ice/runtime/esm/runServerApp.js:71:20)

mum43rcc

mum43rcc2#

提供下复现的 demo

dwbf0jvd

dwbf0jvd3#

ice-demo.zip
windows 访问login就会报错

相关问题