SWA-CLI Data API Builder在Node v18.16.0和unzipper上出现问题。

huangapple go评论107阅读模式
英文:

SWA-CLI Data API Builder issue with Node v18.16.0 and unzipper

问题

I am attempting to use SWA-CLI to run/debug a react web app in a PowerShell terminal in Visual Studio Code on my Windows PC. My setup is:

操作系统:Windows 10 Pro (10.0.19044 Build 19044)
VS Code:1.78.2
PowerShell:5.1.19041.2673
SWA-CLI:1.1.2
Node.js:18.160.0
npm:9.6.6

Problems first showed up when trying to initialize my project for database access:

尝试初始化项目以进行数据库访问时首次出现问题:

PS C:\Local Development\react> swa db init --database-type mssql

Welcome to Azure Static Web Apps CLI (1.1.2)

[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
<ref *1> Error: spawnSync C:\Users\James98\.swa\dataApiBuilder
PS C:\Local Development\react> swa db init --database-type mssql

Welcome to Azure Static Web Apps CLI (1.1.2)

[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
<ref *1> Error: spawnSync C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
    at Object.spawnSync (node:internal/child_process:1110:20)
    at spawnSync (node:child_process:871:24)
    at execFileSync (node:child_process:914:15)
    at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29)
    at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Command.<anonymous> (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7)
    at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5)
    at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) {  
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe',
  path: 'C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe',
  spawnargs: [
    'init',
    '--database-type',
    'mssql',
    '--config',
    'staticwebapp.database.config.json',
    '--rest.path',
    '/rest'
  ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: null,
  stderr: null
}
.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
at Object.spawnSync (node:internal/child_process:1110:20) at spawnSync (node:child_process:871:24) at execFileSync (node:child_process:914:15) at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29) at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Command.<anonymous> (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7) at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5) at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) { errno: -4094, code: 'UNKNOWN', syscall: 'spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\
PS C:\Local Development\react> swa db init --database-type mssql

Welcome to Azure Static Web Apps CLI (1.1.2)

[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
<ref *1> Error: spawnSync C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
    at Object.spawnSync (node:internal/child_process:1110:20)
    at spawnSync (node:child_process:871:24)
    at execFileSync (node:child_process:914:15)
    at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29)
    at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Command.<anonymous> (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7)
    at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5)
    at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) {  
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe',
  path: 'C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe',
  spawnargs: [
    'init',
    '--database-type',
    'mssql',
    '--config',
    'staticwebapp.database.config.json',
    '--rest.path',
    '/rest'
  ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: null,
  stderr: null
}
.7.5\\Microsoft.DataApiBuilder.exe'
,
path: 'C:\\Users\\James98\\.swa\\dataApiBuilder\
PS C:\Local Development\react> swa db init --database-type mssql

Welcome to Azure Static Web Apps CLI (1.1.2)

[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
<ref *1> Error: spawnSync C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
    at Object.spawnSync (node:internal/child_process:1110:20)
    at spawnSync (node:child_process:871:24)
    at execFileSync (node:child_process:914:15)
    at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29)
    at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Command.<anonymous> (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7)
    at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5)
    at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) {  
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe',
  path: 'C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe',
  spawnargs: [
    'init',
    '--database-type',
    'mssql',
    '--config',
    'staticwebapp.database.config.json',
    '--rest.path',
    '/rest'
  ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: null,
  stderr: null
}
.7.5\\Microsoft.DataApiBuilder.exe'
,
spawnargs: [ 'init', '--database-type', 'mssql', '--config', 'staticwebapp.database.config.json', '--rest.path', '/rest' ], error: [Circular *1], status: null, signal: null, output: null, pid: 0, stdout: null, stderr: null }

I managed to work around the above error by creating a swa-db-connections folder and creating my own staticwebapp.database.config.json file (incidentally, when the project is uploaded to my StaticWebApp on Azure, the database connection works GREAT!).

The problem that I can't seem to get around, however, is simulating the project locally. I start the local development server separately because swa doesn't seem to be able to detect when it is up-and-running, but when I try to get swa to manage the database connections, I receive a message saying that Microsoft.DataApiBuilder is not compatible with my Windows version?

设法绕过上述错误,通过创建swa-db-connections文件夹并创建自己的staticwebapp.database.config.json文件来解决了问题(顺便说一句,当项目上传到Azure上的StaticWebApp时,数据库连接工作得很好!)。

然而,我似乎无法解决的问题是在本地模拟项目。我单独启动本地开发服务器,因为swa似乎无法检测到它是否已经启动,但当我尝试让swa管理数据库连接时,我收到一条消息,说Microsoft.DataApiBuilder与我的Windows版本不兼容?

PS C:\Local Development\react> swa start http://localhost:3000 --data-api-location ./swa-db-connections

Welcome to Azure Static Web Apps CLI (1.1.2)

***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure.                           *
***********************************************************************

[swa]  Downloading https://github.com/Azure/data-api-builder/releases/download/v0.7.5/dab_win-x64-0.7.5.zip@0.7.5
[dataApi] This version of C:\Users\James98\.swa\dataApiBuilder
PS C:\Local Development\react> swa start http://localhost:3000 --data-api-location ./swa-db-connections

Welcome to Azure Static Web Apps CLI (1.1.2)

***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure.                           *
***********************************************************************

[swa]  Downloading https://github.com/Azure/data-api-builder/releases/download/v0.7.5/dab_win-x64-0.7.5.zip@0.7.5
[dataApi] This version of C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe is not compatible 
with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
[dataApi] cd "C:\Local Development\react\swa-db-connections" && "C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe" start -c staticwebapp.database.config.json --no-https-redirect exited with code 1
--> Sending SIGTERM to other processes..
[swa] node "C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\msha\server.js" exited with code 1
 SWA emulator stopped because SWA emulator exited with code 1.
.7.5\Microsoft.DataApiBuilder.exe is not compatible
with the version of Windows you're running. Check your computer's system information and then contact the software publisher. [dataApi] cd "C:\Local Development\react\swa-db-connections" && "C:\Users\James98\.swa\dataApiBuilder
PS C:\Local Development\react> swa start http://localhost:3000 --data-api-location ./swa-db-connections

Welcome to Azure Static Web Apps CLI (1.1.2)

***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure.                           *
***********************************************************************

[swa]  Downloading https://github.com/Azure/data-api-builder/releases/download/v0.7.5/dab_win-x64-0.7.5.zip@0.7.5
[dataApi] This version of C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe is not compatible 
with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
[dataApi] cd "C:\Local Development\react\swa-db-connections" && "C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe" start -c staticwebapp.database.config.json --no-https-redirect exited with code 1
--> Sending SIGTERM to other processes..
[swa] node "C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\msha\server.js" exited with code 1
 SWA emulator stopped because SWA emulator exited with code 1.
.7.5\Microsoft.DataApiBuilder.exe"
start -c staticwebapp.database.config.json --no-https-redirect exited with code 1
--> Sending SIGTERM to other processes.. [swa] node "C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\msha\server.js" exited with code 1 SWA emulator stopped because SWA emulator exited with code 1.

I am not sure where to even start troubleshooting since I am running up-to-date versions of Windows, SWA-CLI, Node, and npm... If anyone has any suggestions of what to try next, I would GREATLY appreciate them!

当我首次遇到错误时,我更新了我的工具集。我不知道我开始时每个工具的版本是什么。但是,我使用顶部列出的更新工具得到相同的行为。

一旦这样做,我尝试多次卸载/重新安装swa,使用以下命令:

npm uninstall  @azure/static-web-apps-cli
npm install -g @azure/static-web-apps-cli

我还尝试删除C:\Users\James98\.swa\dataApiBuilder文件夹。

英文:

I am attempting to use SWA-CLI to run/debug a react web app in a PowerShell terminal in Visual Studio Code on my Windows PC. My setup is:

OS: Windows 10 Pro (10.0.19044 Build 19044)
VS Code: 1.78.2
PowerShell: 5.1.19041.2673
SWA-CLI: 1.1.2
Node.js: 18.160.0
npm: 9.6.6

Problems first showed up when trying to initialize my project for database access:

PS C:\Local Development\react&gt; swa db init --database-type mssql

Welcome to Azure Static Web Apps CLI (1.1.2)

[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

&lt;ref *1&gt; Error: spawnSync C:\Users\James98\.swa\dataApiBuilder
PS C:\Local Development\react&gt; swa db init --database-type mssql
Welcome to Azure Static Web Apps CLI (1.1.2)
[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
&lt;ref *1&gt; Error: spawnSync C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
at Object.spawnSync (node:internal/child_process:1110:20)
at spawnSync (node:child_process:871:24)
at execFileSync (node:child_process:914:15)
at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29)
at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Command.&lt;anonymous&gt; (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7)
at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5)
at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) {  
errno: -4094,
code: &#39;UNKNOWN&#39;,
syscall: &#39;spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe&#39;,
path: &#39;C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe&#39;,
spawnargs: [
&#39;init&#39;,
&#39;--database-type&#39;,
&#39;mssql&#39;,
&#39;--config&#39;,
&#39;staticwebapp.database.config.json&#39;,
&#39;--rest.path&#39;,
&#39;/rest&#39;
],
error: [Circular *1],
status: null,
signal: null,
output: null,
pid: 0,
stdout: null,
stderr: null
}
.7.5\Microsoft.DataApiBuilder.exe UNKNOWN at Object.spawnSync (node:internal/child_process:1110:20) at spawnSync (node:child_process:871:24) at execFileSync (node:child_process:914:15) at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29) at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Command.&lt;anonymous&gt; (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7) at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5) at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) { errno: -4094, code: &#39;UNKNOWN&#39;, syscall: &#39;spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\
PS C:\Local Development\react&gt; swa db init --database-type mssql
Welcome to Azure Static Web Apps CLI (1.1.2)
[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
&lt;ref *1&gt; Error: spawnSync C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
at Object.spawnSync (node:internal/child_process:1110:20)
at spawnSync (node:child_process:871:24)
at execFileSync (node:child_process:914:15)
at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29)
at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Command.&lt;anonymous&gt; (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7)
at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5)
at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) {  
errno: -4094,
code: &#39;UNKNOWN&#39;,
syscall: &#39;spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe&#39;,
path: &#39;C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe&#39;,
spawnargs: [
&#39;init&#39;,
&#39;--database-type&#39;,
&#39;mssql&#39;,
&#39;--config&#39;,
&#39;staticwebapp.database.config.json&#39;,
&#39;--rest.path&#39;,
&#39;/rest&#39;
],
error: [Circular *1],
status: null,
signal: null,
output: null,
pid: 0,
stdout: null,
stderr: null
}
.7.5\\Microsoft.DataApiBuilder.exe&#39;, path: &#39;C:\\Users\\James98\\.swa\\dataApiBuilder\
PS C:\Local Development\react&gt; swa db init --database-type mssql
Welcome to Azure Static Web Apps CLI (1.1.2)
[swa] Creating database connections configuration folder swa-db-connections
[swa] Creating staticwebapp.database.config.json configuration file
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
&lt;ref *1&gt; Error: spawnSync C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe UNKNOWN
at Object.spawnSync (node:internal/child_process:1110:20)
at spawnSync (node:child_process:871:24)
at execFileSync (node:child_process:914:15)
at execFileCommand (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\core\utils\command.ts:18:29)
at init (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\init.ts:110:18)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Command.&lt;anonymous&gt; (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\commands\db\init\register.ts:30:7)
at Command.parseAsync (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\node_modules\commander\lib\command.js:935:5)
at run (C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\src\cli\index.ts:106:3) {  
errno: -4094,
code: &#39;UNKNOWN&#39;,
syscall: &#39;spawnSync C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe&#39;,
path: &#39;C:\\Users\\James98\\.swa\\dataApiBuilder\\0.7.5\\Microsoft.DataApiBuilder.exe&#39;,
spawnargs: [
&#39;init&#39;,
&#39;--database-type&#39;,
&#39;mssql&#39;,
&#39;--config&#39;,
&#39;staticwebapp.database.config.json&#39;,
&#39;--rest.path&#39;,
&#39;/rest&#39;
],
error: [Circular *1],
status: null,
signal: null,
output: null,
pid: 0,
stdout: null,
stderr: null
}
.7.5\\Microsoft.DataApiBuilder.exe&#39;, spawnargs: [ &#39;init&#39;, &#39;--database-type&#39;, &#39;mssql&#39;, &#39;--config&#39;, &#39;staticwebapp.database.config.json&#39;, &#39;--rest.path&#39;, &#39;/rest&#39; ], error: [Circular *1], status: null, signal: null, output: null, pid: 0, stdout: null, stderr: null }

I managed to work around the above error by creating a swa-db-connections folder and creating my own staticwebapp.database.config.json file (incidentally, when the project is uploaded to my StaticWebApp on Azure, the database connection works GREAT!).

The problem that I can't seem to get around, however, is simulating the project locally. I start the local development server separately because swa doesn't seem to be able to detect when it is up-and-running, but when I try to get swa to manage the database connections, I receive a message saying that Microsoft.DataApiBuilder is not compatible with my Windows version?

PS C:\Local Development\react&gt; swa start http://localhost:3000 --data-api-location ./swa-db-connections

Welcome to Azure Static Web Apps CLI (1.1.2)

***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure.                           *
***********************************************************************

[swa] ✔ Downloading https://github.com/Azure/data-api-builder/releases/download/v0.7.5/dab_win-x64-0.7.5.zip@0.7.5
[dataApi] This version of C:\Users\James98\.swa\dataApiBuilder
PS C:\Local Development\react&gt; swa start http://localhost:3000 --data-api-location ./swa-db-connections
Welcome to Azure Static Web Apps CLI (1.1.2)
***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure.                           *
***********************************************************************
[swa] ✔ Downloading https://github.com/Azure/data-api-builder/releases/download/v0.7.5/dab_win-x64-0.7.5.zip@0.7.5
[dataApi] This version of C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe is not compatible 
with the version of Windows you&#39;re running. Check your computer&#39;s system information and then contact the software publisher.
[dataApi] cd &quot;C:\Local Development\react\swa-db-connections&quot; &amp;&amp; &quot;C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe&quot; start -c staticwebapp.database.config.json --no-https-redirect exited with code 1
--&gt; Sending SIGTERM to other processes..
[swa] node &quot;C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\msha\server.js&quot; exited with code 1
✖ SWA emulator stoped because SWA emulator exited with code 1.
.7.5\Microsoft.DataApiBuilder.exe is not compatible with the version of Windows you&#39;re running. Check your computer&#39;s system information and then contact the software publisher. [dataApi] cd &quot;C:\Local Development\react\swa-db-connections&quot; &amp;&amp; &quot;C:\Users\James98\.swa\dataApiBuilder
PS C:\Local Development\react&gt; swa start http://localhost:3000 --data-api-location ./swa-db-connections
Welcome to Azure Static Web Apps CLI (1.1.2)
***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure.                           *
***********************************************************************
[swa] ✔ Downloading https://github.com/Azure/data-api-builder/releases/download/v0.7.5/dab_win-x64-0.7.5.zip@0.7.5
[dataApi] This version of C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe is not compatible 
with the version of Windows you&#39;re running. Check your computer&#39;s system information and then contact the software publisher.
[dataApi] cd &quot;C:\Local Development\react\swa-db-connections&quot; &amp;&amp; &quot;C:\Users\James98\.swa\dataApiBuilder\0.7.5\Microsoft.DataApiBuilder.exe&quot; start -c staticwebapp.database.config.json --no-https-redirect exited with code 1
--&gt; Sending SIGTERM to other processes..
[swa] node &quot;C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\msha\server.js&quot; exited with code 1
✖ SWA emulator stoped because SWA emulator exited with code 1.
.7.5\Microsoft.DataApiBuilder.exe&quot; start -c staticwebapp.database.config.json --no-https-redirect exited with code 1 --&gt; Sending SIGTERM to other processes.. [swa] node &quot;C:\Users\James98\AppData\Roaming\npm\node_modules\@azure\static-web-apps-cli\dist\msha\server.js&quot; exited with code 1 ✖ SWA emulator stoped because SWA emulator exited with code 1.

I am not sure where to even start troubleshooting since I am running up-to-date versions of Windows, SWA-CLI, Node and npm...If anyone has any suggestions of what to try next, I would GREATLY appreciate them!

When I first encountered the error, I updated my toolset(s). I don't know what version each tool was when I started. But I am getting the same behavior with the updated tools that are listed at the top.

Once doing that, I have tried uninstalling/reinstalling swa multiple times using:

npm uninstall  @azure/static-web-apps-cli
npm install -g @azure/static-web-apps-cli

I have also tried deleting the folder at C:\Users\James98\.swa\dataApiBuilder.

答案1

得分: 4

以下是翻译好的部分:

看起来这是unzipper的问题,该工具用于解压DataApiBuilder的zip文件。它在Node v18.16.0上无法正常工作,因此导致提取的文件损坏。

有一些解决此问题的选项。

选项 1. 升级 swa-cli 到 v1.1.4 或更高版本。这个版本不再使用 unzipper
选项 2. 降级 Node.js 到 v16.x 或 v18.15.0。
选项 3.(继续使用 Node 18.16.0)手动将 c:\users\{account}\.swa\dataApiBuilder\%VERSION_OF_DAB%\dab_win-x64-%VERSION_OF_DAB%.zip 解压到 c:\users\{account}\.swa\dataApiBuilder\%VERSION_OF_DAB%

另外

您可能需要删除文件夹 %USERPROFILE%\.swa\dataApiBuilder\ 或至少删除文件夹内的内容,以便任何无效文件可以被有效文件替换。

英文:

Looks like this is a issue of unzipper which is used for extracting the zip file of DataApiBuilder. It cannot work properly on Node v18.16.0. As a result, the extracted files are broken.

There are some options to resolve this issue.

Option 1. Upgrade swa-cli to v1.1.4 or later. This version doesn't use unzipper.
Option 2. Downgrade Node.js to v16.x or v18.15.0
Option 3. (Keep using Node 18.16.0) Extract c:\users\{account}\.swa\dataApiBuilder\%VERSION_OF_DAB%\dab_win-x64-%VERSION_OF_DAB%.zip manually into c:\users\{account}\.swa\dataApiBuilder\%VERSION_OF_DAB%

Also

You may need to delete the folder or, at least, the contents of the folder at %USERPROFILE%\.swa\dataApiBuilder\ so any invalid files can be replaced by valid files.

答案2

得分: 2

我遇到了类似的错误,通过将我的 Node.js 版本从 18 降级到 16,我成功解决了它。降级后,swa 命令成功运行。

英文:

I encountered a similar error, and I was able to resolve it by downgrading my Node.js version from 18 to 16. After the downgrade, the swa command worked successfully.

huangapple
  • 本文由 发表于 2023年5月14日 02:10:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76244231.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定