这是indexloc提供的服务,不要输入任何密码
Skip to content

Turbo doesn't work in docker windowserver #8878

@zZHorizonZz

Description

@zZHorizonZz

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/vercel/turbo

What package manager are you using / does the bug impact?

npm, Yarn v2/v3/v4 (node_modules linker only)

What operating system are you using?

Windows

Which canary version will you have in your reproduction?

v2.0.10-canary.2

Describe the Bug

I need to create a build for an application that works on multiple platforms, e.g., Linux and Windows. The Linux Docker build works fine, but when I try to create a similar build based on Windows Server, the Turbo CLI doesn't seem to work. It appears to run, but there is no output, and the exit code I get by running $LastExitCode is similar to -1073741515. What seems weird is that, Turbo works when installed on a standalone Windows Server.

I've tried executing the turbo.exe directly, but the behavior doesn't change, so the execution scripts (turbo.cmd, etc.) are working correctly. Which means that there is something wrong with the CLI itself. The only thing I can think of is that some dependencies might be missing, dependencies that come bundled with Windows or a standalone Windows Server but not with Windows server docker images, but I have tried using different versions servercore and server, and nothing changes.

Expected Behavior

The turbo cli should work.

To Reproduce

Try building this image for windows platform:

FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS base

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('C:\nodejs;{0}\Yarn\bin;{1}' -f $env:LOCALAPPDATA, $env:PATH); \
	Write-Host ('Updating PATH: {0}' -f $newPath); \
	[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
# doing this first to share cache across versions more aggressively

ENV NODE_VERSION 21.7.3
ENV NODE_SHA256 d2314f496782b53ad2fe5fa82fca6ff7f39f07fe59dd007116404ad92179c78e

RUN $url = ('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION); \
	Write-Host ('Downloading {0} ...' -f $url); \
	Invoke-WebRequest -Uri $url -OutFile 'node.zip'; \
	\
	Write-Host ('Verifying sha256 ({0}) ...' -f $env:NODE_SHA256); \
	if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) { throw 'SHA256 mismatch' }; \
	\
	Write-Host 'Expanding ...'; \
	Expand-Archive node.zip -DestinationPath C:\; \
	\
	Write-Host 'Renaming ...'; \
	Rename-Item -Path ('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'; \
	\
	Write-Host 'Removing ...'; \
	Remove-Item node.zip -Force; \
	\
	Write-Host 'Verifying ("node --version") ...'; \
	node --version; \
	Write-Host 'Verifying ("npm --version") ...'; \
	npm --version; \
	\
	Write-Host 'Complete.'

ENV YARN_VERSION 1.22.21

# "It is recommended to install Yarn through the npm package manager" (https://classic.yarnpkg.com/en/docs/install)
RUN Write-Host 'Installing "yarn" ...'; \
	npm install --global ('yarn@{0}' -f $env:YARN_VERSION); \
	\
	Write-Host 'Verifying ("yarn --version") ...'; \
	yarn --version; \
	\
	Write-Host 'Complete.'

CMD [ "node" ]

FROM base AS builder

# Set working directory
WORKDIR /app

COPY . .

RUN yarn global add turbo
RUN yarn global add @redocly/cli

CMD [ "powershell", "-Command", "while ($true) { Write-Host 'Still running...'; Start-Sleep -Seconds 3000; }" ]

And the executing the powershell -Command turbo; $LastExitCode in exec of the container.

Additional context

I have tested this agains multiple version ranging from 1.7.0 to most latest and also canary builds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions