[Bug] `downloadCoreTools` fails with `ENOENT: chmod 'gozip'` because current Core Tools releases no longer ship `gozip`
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- node.js, typescript
- 領域
- cli
調査の方向性
src/core/func-core-tools.ts の downloadCoreTools() から始め、~/.swa/core-tools を削除した後、記載されている npx コマンドで再現します。展開された Core Tools に func は含まれるが gozip は含まれない場合でも起動に成功することを、既存の権限処理を維持したまま確認します。
索引モデルが issue の本文から書いたものです。
説明
Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.
I am using @azure/static-web-apps-cli 2.0.10, which is the latest version on npm at the time of writing.
Are you accessing the CLI from the default port :4280 ?
- No, I am using a different port number (
--port) and accessing the CLI from that port - Yes, I am accessing the CLI from port
:4280
(Note: the failure occurs during startup, before the emulator begins listening, so the port is not a factor in this bug.)
ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly
Verbose log (user-specific paths and names redacted as <user>, <project-root>, etc.)
Welcome to Azure Static Web Apps CLI (2.0.10)
Getting config file options from "swa-cli.config.json"...
Config file does not exist at "swa-cli.config.json"
***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure. *
***********************************************************************
Checking if localhost:4280 is accepting TCP connections...
Port 4280 is available. Use it.
Resolved port number: 4280
appDevserverUrl provided, we will try connect to dev server at .
Api Folder found: /home/<user>/<project-root>/api
Trying to read workflow config with values:
- appLocation: /home/<user>/<project-root>
- outputLocation: http://localhost:<dev-server-port>
- apiLocation: /home/<user>/<project-root>/api
Found a SWA workflow file: /home/<user>/<project-root>/.github/workflows/azure-static-web-apps-<name>.yml
Error reading workflow configuration:
missing property "jobs.build_and_deploy_job" in the SWA workflow file "/home/<user>/<project-root>/.github/workflows/azure-static-web-apps-<name>.yml".
See https://docs.microsoft.com/azure/static-web-apps/build-configuration?tabs=github-actions#build-configuration for more information.
✖ Failed to download Functions Core Tools v4.
✖ Error: ENOENT: no such file or directory, chmod '/home/<user>/.swa/core-tools/v4/gozip'
Error: ENOENT: no such file or directory, chmod '/home/<user>/.swa/core-tools/v4/gozip'
at Object.chmodSync (node:fs:2050:11)
at downloadCoreTools (file:///home/<user>/.npm/_npx/<hash>/node_modules/@azure/static-web-apps-cli/src/core/func-core-tools.ts:257:8)
at processTicksAndRejections (node:internal/process/task_queues:104:5)
at getCoreToolsBinary (file:///home/<user>/.npm/_npx/<hash>/node_modules/@azure/static-web-apps-cli/src/core/func-core-tools.ts:290:5)
at start (file:///home/<user>/.npm/_npx/<hash>/node_modules/@azure/static-web-apps-cli/src/cli/commands/start/start.ts:182:26)
at Command.<anonymous> (file:///home/<user>/.npm/_npx/<hash>/node_modules/@azure/static-web-apps-cli/src/cli/commands/start/register.ts:75:7)
at Command.parseAsync (/home/<user>/.npm/_npx/<hash>/node_modules/commander/lib/command.js:935:5)
at run (file:///home/<user>/.npm/_npx/<hash>/node_modules/@azure/static-web-apps-cli/src/cli/index.ts:98:3) {
errno: -2,
code: 'ENOENT',
syscall: 'chmod',
path: '/home/<user>/.swa/core-tools/v4/gozip'
}
✖
Could not find or install Azure Functions Core Tools.
Install Azure Functions Core Tools with:
npm i -g azure-functions-core-tools@4 --unsafe-perm true
See https://aka.ms/functions-core-tools for more information.
Note: the "Error reading workflow configuration" warning above comes from my local workflow file and is unrelated to this bug — the same ENOENT: chmod 'gozip' failure reproduces with the minimal steps below, without any workflow file.
Describe the bug
When swa start is run with --api-location, the CLI calls getCoreToolsBinary(), which downloads Azure Functions Core Tools if no usable installation is found. After the package is downloaded and unzipped successfully, downloadCoreTools() (src/core/func-core-tools.ts) unconditionally runs chmodSync on a file named gozip on Linux/macOS. Current Core Tools releases no longer include gozip, so the call throws ENOENT and the entire startup fails — even though the func binary itself was downloaded and extracted correctly.
Root cause details are in Additional context below.
To Reproduce
Steps to reproduce the behavior (minimal reproduction — the failure is independent of any project contents, because it happens inside downloadCoreTools before the API is ever started):
- Use a Linux x64 machine (Ubuntu, Node.js v24) where the
funcbinary is not detected globally - Remove any cached Core Tools:
rm -rf ~/.swa/core-tools - Create an empty directory to pass as the API location:
mkdir -p app api - Run:
npx @azure/static-web-apps-cli@2.0.10 start ./app --api-location ./api - The CLI attempts to download Functions Core Tools v4 and fails with
ENOENT: no such file or directory, chmod '~/.swa/core-tools/v4/gozip'
Expected behavior
- Startup should succeed as long as
funcitself was downloaded and extracted correctly, even ifgozipis absent. For the local development scenario covered byswa start,gozipwas a packaging/deployment helper and should not be required. - At minimum, the code should check whether the file exists (e.g.
fs.existsSync) before callingchmodSync, and skip (or log a warning) if it does not.
Screenshots
N/A — see the error log above.
Desktop (please complete the following information):
- OS: Ubuntu (Linux x64)
- Node.js: v24.18.0
@azure/static-web-apps-cli: 2.0.10azure-functions-core-tools(installed via npm, for reference): 4.13.0
Additional context
Root cause (investigated):
gozip is no longer included in current azure-functions-core-tools releases — neither in the npm distribution (4.13.0) nor in the full linux-x64 archive (4.12.1) downloaded directly from GitHub Releases. I inspected the extracted archives: there is no file named gozip; instead they ship System.IO.Compression.ZipFile.dll (the standard .NET compression library). It appears the Core Tools team replaced the external Go binary (gozip) used for packaging with the standard .NET library.
However, downloadCoreTools still assumes gozip exists and chmods it unconditionally on Linux/macOS (current main, src/core/func-core-tools.ts):
// Fix permissions on MacOS/Linux
if (os.platform() === "linux" || os.platform() === "darwin") {
fs.chmodSync(path.join(dest, "func"), 0o755);
fs.chmodSync(path.join(dest, "gozip"), 0o755); // <-- throws ENOENT
}
Suggested fix:
Guard the chmodSync call on gozip with an existence check:
const gozipPath = path.join(dest, "gozip");
if (fs.existsSync(gozipPath)) {
fs.chmodSync(gozipPath, 0o755);
}
Related issue:
#899 is a past case where the download flow broke because assumptions about the distribution feed/artifacts no longer held (Windows, missing size: "full" artifact). This report is a different, newer cause: the removal of gozip itself from the shipped artifacts.
Workaround:
Skip the automatic Core Tools startup entirely: start Azure Functions Core Tools separately with func start, then connect the SWA CLI to it:
swa start <app-url> --api-devserver-url <local-api-url>
This corresponds to the "Manual start" flow in the official docs and does not go through downloadCoreTools, so it is unaffected by this bug.
- 主要言語
- TypeScript
- スター
- 668
- フォーク
- 155
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/static-web-apps-cli のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
Azure/static-web-apps-cli#1002 · コメント 2 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
Azure/static-web-apps-cli#998 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
Azure/static-web-apps-cli#997 · コメント 1 件 ·
-
Support ARM64 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
Azure/static-web-apps-cli#987 · コメント 2 件 · リアクション 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
Azure/static-web-apps-cli#986 ·
Azure/static-web-apps-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
fullcalendar/fullcalendar#8106 ·