Skip to content

Commit 2a6faf7

Browse files
committed
fix(container): set NODE_PATH to resolve global node modules
1 parent e0a36b1 commit 2a6faf7

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

images/chromium-headful/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ RUN set -eux; \
170170
# Install TypeScript and Playwright globally
171171
RUN npm install -g typescript tsx playwright
172172

173+
# Set NODE_PATH so that globally installed modules can be resolved
174+
ENV NODE_PATH=/usr/lib/node_modules
175+
173176
# setup desktop env & app
174177
ENV DISPLAY_NUM=1
175178
ENV HEIGHT=768

images/chromium-headless/image/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ RUN set -eux; \
8282
# Install TypeScript and Playwright globally
8383
RUN npm install -g typescript tsx playwright
8484

85+
# Set NODE_PATH so that globally installed modules can be resolved
86+
ENV NODE_PATH=/usr/lib/node_modules
87+
8588
ENV WITHDOCKER=true
8689

8790
# Create a non-root user with a home directory

server/cmd/api/api/playwright.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ func (s *ApiService) ExecutePlaywrightCode(ctx context.Context, request oapi.Exe
6262

6363
// Execute the Playwright code via the executor script
6464
cmd := exec.CommandContext(execCtx, "tsx", "/usr/local/lib/playwright-executor.ts", tmpFilePath)
65-
// Set NODE_PATH to point to global node_modules so playwright can be resolved
66-
cmd.Env = append(os.Environ(), "NODE_PATH=/usr/lib/node_modules")
6765

6866
output, err := cmd.CombinedOutput()
6967

0 commit comments

Comments
 (0)