启用SSL后搭配NextJS开发服务器的SWA CLI模拟器崩溃
问题描述
尝试使用SWA模拟器运行Next.js开发服务器,启用SSL后,模拟器在首次请求后崩溃。但将Next.js站点静态导出后,使用导出文件夹运行模拟器则一切正常。已尝试使用旧版本SWA CLI、禁用NVM并直接安装Node.js,问题仍未解决。
swa-cli.config.json
{ "$schema": "https://aka.ms/azure/static-web-apps-cli/schema", "configurations": { "new-swa-test": { "appLocation": ".", "outputLocation": ".next", "appBuildCommand": "npm run build", "run": "npm run dev", "appDevserverUrl": "http://localhost:3001", "ssl": true, "verbose": "silly" } } }
package.json 脚本
"scripts": { "dev": "next dev -p 3001", "build": "next build", "start": "next start", "lint": "next lint" },
执行swa start后的输出(证书信息已省略)
[swa] node "C:\Users\heinonenjj\AppData\Roaming\nvm\v18.14.0\node_modules@azure\static-web-apps-cli\dist\msha\server.js" exited with code 0 --> Sending SIGTERM to other processes.. [run] cd "C:\code\swa-test\new-swa-test" && npm run dev exited with code 1 ✖ SWA emulator stoped because the --run command exited with code 1.
内容的提问来源于stack exchange,提问作者Jyrki Heinonen
相关产品推荐
相关产品推荐

