Skip to content

@vercel/ncc build run error #228

Description

@chyftom
  1. "bundle": "npm run build && ncc build bootstrap.js -o build

  2. cd build

  3. node .\index.js

  4. 错误如下:
    node:1164) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
    (Use node --trace-deprecation ... to show where the warning was created)
    2025-10-31 09:16:55.797 ERROR 1164 TypeError: Cannot read properties of undefined (reading 'routerOptions')
    at MidwayWebRouterService.addController (F:\nongye\cool\cool-admin-midway\build\index.js:99883:59)
    at MidwayWebRouterService.analyzeController (F:\nongye\cool\cool-admin-midway\build\index.js:99846:18)
    at MidwayWebRouterService.analyze (F:\nongye\cool\cool-admin-midway\build\index.js:99839:14)
    at MidwayWebRouterService.getRouterTable (F:\nongye\cool\cool-admin-midway\build\index.js:100069:24)
    at KoaControllerGenerator.loadMidwayController (F:\nongye\cool\cool-admin-midway\build\index.js:92722:63)
    at MidwayKoaFramework.loadMidwayController (F:\nongye\cool\cool-admin-midway\build\index.js:105300:30)
    at MidwayKoaFramework.run (F:\nongye\cool\cool-admin-midway\build\index.js:105323:20)
    at MidwayFrameworkService.runFramework (F:\nongye\cool\cool-admin-midway\build\index.js:98340:41)
    at MidwayLifeCycleService.init (F:\nongye\cool\cool-admin-midway\build\index.js:98660:37)
    at async ObjectCreator.doInitAsync (F:\nongye\cool\cool-admin-midway\build\index.js:96189:17)
    2025-10-31 09:16:55.802 INFO 1164 [midway:bootstrap] exit with code:1

具体代码如下:
addController(controllerClz, controllerOption, resourceOptions = {}, functionMeta = false) {
var _a;
if (resourceOptions && typeof resourceOptions === 'boolean') {
functionMeta = resourceOptions;
resourceOptions = undefined;
}
if (!resourceOptions) {
resourceOptions = {};
}
const controllerId = (0, decorator_1.getProviderName)(controllerClz);
debug([core]: Found Controller ${controllerId}.);
const id = (0, decorator_1.getProviderUUId)(controllerClz);
controllerOption.routerOptions = controllerOption.routerOptions || {};
let priority;
// implement middleware in controller

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions