【问题标题】:How to deploy a static website on azure using Visual Code studio?如何使用 Visual Code Studio 在 Azure 上部署静态网站?
【发布时间】:2019-01-10 13:59:15
【问题描述】:
我一直在关注this 教程来开发和构建 nodejs 应用程序。
当我使用命令构建 package.json 文件时,missing script: build 错误来了。
一个可能的解决方案是手动编辑 package.json 文件中的“构建”键:值对,但我不知道在其中的 value 部分中添加什么来构建 webapp。
目前我的 package.json 包含:
{
"name": "my-react-app",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "echo 'build script executed'"
}
}
在它之后,应该有一个名为 build 的文件夹,但它不会发生在所有 html、css 和 js 文件所在的位置。
所有软件包都是最新的。
运行 Windows 10。
【问题讨论】:
标签:
visual-studio
azure
azure-sql-database
azure-web-app-service
azure-blob-storage
【解决方案1】:
我也按照您提到的教程进行操作。我可以在我这边构建 webapp correclty。
构建脚本:react-scripts build。关于 Package.json 的更多详细信息请参考我的 package.json。
我的 Package.json
{
"name": "my-react-appp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
如果您尚未安装 Azure App Serviceextension ,则需要从 Visual Studio 代码市场安装它。之后,您可以直接使用 VS 代码将其发布到 Azure webApp。