[BUG] web build fails with 'Named export 'APIKeyApi' not found' #1987

Closed
opened 2026-02-05 04:40:51 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @waclaw66 on GitHub (Jan 15, 2024).

The bug

I'm trying to build web according immich/server/Dockerfile as usual, however it fails on npm run build with following message...
Not sure what could be wrong, open-api is already built.

node:internal/event_target:1088
  process.nextTick(() => { throw err; });
                           ^
file:///home/waclaw/src/immich/web/.svelte-kit/output/server/chunks/api.js:1
import { configuration, ActivityApi, AlbumApi, AuditApi, LibraryApi, AssetApi, AuthenticationApi, FaceApi, JobApi, APIKeyApi, OAuthApi, PartnerApi, SearchApi, ServerInfoApi, SharedLinkApi, PersonApi, SystemConfigApi, UserApi, common, base, JobName, AssetJobName } from "@immich/sdk";
                                                                                                                   ^^^^^^^^^
SyntaxError: Named export 'APIKeyApi' not found. The requested module '@immich/sdk' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@immich/sdk';
const { configuration, ActivityApi, AlbumApi, AuditApi, LibraryApi, AssetApi, AuthenticationApi, FaceApi, JobApi, APIKeyApi, OAuthApi, PartnerApi, SearchApi, ServerInfoApi, SharedLinkApi, PersonApi, SystemConfigApi, UserApi, common, base, JobName, AssetJobName } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async analyse (file:///home/waclaw/src/immich/web/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:60:16)
    at async MessagePort.<anonymous> (file:///home/waclaw/src/immich/web/node_modules/@sveltejs/kit/src/utils/fork.js:22:16)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:326:10)
    at [kOnMessage] (node:internal/worker:337:37)
    at MessagePort.<anonymous> (node:internal/worker:232:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:814:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

When I try to run npm run dev, it fails with...

Unexpected token 'export'

/home/waclaw/src/immich/web/node_modules/@immich/sdk/build/esm/index.js:1
export * from './client';
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:345:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24

The OS that Immich Server is running on

Fedora 39

Version of Immich Server

main

Version of Immich Mobile App

not relevant

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

not relevant

Your .env content

not relevant

Reproduction steps

manual execution of commands from immich/server/Dockerfile

Additional information

No response

Originally created by @waclaw66 on GitHub (Jan 15, 2024). ### The bug I'm trying to build web according `immich/server/Dockerfile` as usual, however it fails on `npm run build` with following message... Not sure what could be wrong, open-api is already built. ``` node:internal/event_target:1088 process.nextTick(() => { throw err; }); ^ file:///home/waclaw/src/immich/web/.svelte-kit/output/server/chunks/api.js:1 import { configuration, ActivityApi, AlbumApi, AuditApi, LibraryApi, AssetApi, AuthenticationApi, FaceApi, JobApi, APIKeyApi, OAuthApi, PartnerApi, SearchApi, ServerInfoApi, SharedLinkApi, PersonApi, SystemConfigApi, UserApi, common, base, JobName, AssetJobName } from "@immich/sdk"; ^^^^^^^^^ SyntaxError: Named export 'APIKeyApi' not found. The requested module '@immich/sdk' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using: import pkg from '@immich/sdk'; const { configuration, ActivityApi, AlbumApi, AuditApi, LibraryApi, AssetApi, AuthenticationApi, FaceApi, JobApi, APIKeyApi, OAuthApi, PartnerApi, SearchApi, ServerInfoApi, SharedLinkApi, PersonApi, SystemConfigApi, UserApi, common, base, JobName, AssetJobName } = pkg; at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21) at async ModuleJob.run (node:internal/modules/esm/module_job:214:5) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) at async analyse (file:///home/waclaw/src/immich/web/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:60:16) at async MessagePort.<anonymous> (file:///home/waclaw/src/immich/web/node_modules/@sveltejs/kit/src/utils/fork.js:22:16) Emitted 'error' event on Worker instance at: at [kOnErrorMessage] (node:internal/worker:326:10) at [kOnMessage] (node:internal/worker:337:37) at MessagePort.<anonymous> (node:internal/worker:232:57) at [nodejs.internal.kHybridDispatch] (node:internal/event_target:814:20) at exports.emitMessage (node:internal/per_context/messageport:23:28) ``` When I try to run `npm run dev`, it fails with... ``` Unexpected token 'export' /home/waclaw/src/immich/web/node_modules/@immich/sdk/build/esm/index.js:1 export * from './client'; ^^^^^^ SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:77:18) at wrapSafe (node:internal/modules/cjs/loader:1288:20) at Module._compile (node:internal/modules/cjs/loader:1340:27) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at cjsLoader (node:internal/modules/esm/translators:345:17) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7) at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24 ``` ### The OS that Immich Server is running on Fedora 39 ### Version of Immich Server main ### Version of Immich Mobile App not relevant ### Platform with the issue - [ ] Server - [X] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML not relevant ``` ### Your .env content ```Shell not relevant ``` ### Reproduction steps ```bash manual execution of commands from immich/server/Dockerfile ``` ### Additional information _No response_
Author
Owner

@martabal commented on GitHub (Jan 15, 2024):

Have you moved any folders ? Just updated the AIO image for v1.93.0 without any issue

@martabal commented on GitHub (Jan 15, 2024): Have you moved any folders ? Just updated the AIO image for v1.93.0 without any issue
Author
Owner

@waclaw66 commented on GitHub (Jan 15, 2024):

Not sure, what folders do you mean? I haven't moved any folders, I'm just trying to execute build commands from server/Dockerfile without using Docker.

@waclaw66 commented on GitHub (Jan 15, 2024): Not sure, what folders do you mean? I haven't moved any folders, I'm just trying to execute build commands from `server/Dockerfile` without using Docker.
Author
Owner

@martabal commented on GitHub (Jan 15, 2024):

Not sure, what folders do you mean?

Root folders in the repo such as web, server, open-api ...

I'm just trying to execute build commands from server/Dockerfile

Oh sorry, according to your logs, I thought the error occurred when building the web app

@martabal commented on GitHub (Jan 15, 2024): > Not sure, what folders do you mean? Root folders in the repo such as `web`, `server`, `open-api` ... > I'm just trying to execute build commands from server/Dockerfile Oh sorry, according to your logs, I thought the error occurred when building the web app
Author
Owner

@waclaw66 commented on GitHub (Jan 15, 2024):

Root folders in the repo such as web, server, open-api ...

Haven't touch them.

Oh sorry, according to your logs, I thought the error occurred when building the web app

Yes, I'm building web app, open-api and server has been built without any error, but web is failing.

@waclaw66 commented on GitHub (Jan 15, 2024): > Root folders in the repo such as `web`, `server`, `open-api` ... Haven't touch them. > Oh sorry, according to your logs, I thought the error occurred when building the web app Yes, I'm building web app, open-api and server has been built without any error, but web is failing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#1987