繁体   English   中英

在 Azure 上部署带有 NodeJs 后端的 create-react-app

[英]Deploying create-react-app with NodeJs Backend on Azure

我使用 NodeJS 后端的 npm create-react-app 制作了一个 React 应用程序。 我正在尝试通过 Visual Studio Code 扩展在 Azure 上进行部署。

我没有在本地构建,而是在 package.json (根文件夹)的脚本 object 中放置了一个脚本

 "build": "cd client && npm install && npm run build"

我的 server.js 解析到 react 应用程序的路由,如下所示:

app.use(express.static("client/build"));
app.get("*", (req, res) => {
  res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));
});

在我配置应用服务、资源计划等并部署到应用服务中的应用后,我得到

Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x
Found bindings for the following environments:
Windows 64-bit with Node.js 12.x

我在应用服务中的 Files 文件夹是空的(只有 hostingstart.html )

我尝试删除 node-sass 并再次安装它,我尝试重建它但没有任何帮助。

你可以先查看你的node-sass版本: npm ls node-sass

查看Node-sass 版本 URL

我认为您通过删除和重新安装 package 完成了正确的操作,请确保在项目的根路径中运行这些命令。

    npm rebuild node-sass
    npm update

    npm uninstall node-sass
    npm install node-sass

不要忘记重新启动您的项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM