简体   繁体   English

在仅包含后端的 Microsoft Azure 中部署 nodejs 项目

[英]Deploy a nodejs project in Microsoft Azure containing backend only

I am developing a angular project with node js as backend.我正在开发一个 angular 项目,以 node js 作为后端。 In the backend microservices are used.在后端使用微服务。 Frontend and backend are seperate projects.前端和后端是独立的项目。 I am trying to deploy both in azure.我正在尝试将两者都部署在 azure 中。 I was able to deploy the front end properly.我能够正确部署前端。 I tried to deploy the backend too.我也尝试部署后端。 But it was not successful.但这并不成功。 Does anyone know how to deploy a node js project with backend only in azure?有谁知道如何仅在 azure 中部署带有后端的节点 js 项目?

UPDATE : The thing is that I don't have a dist folder to build the node project.更新:问题是我没有 dist 文件夹来构建节点项目。 It just contains a server with microservices.它只包含一个带有微服务的服务器。 What we do is we will use npm start to run it.我们所做的是我们将使用 npm 开始运行它。 When I try to hit the backend from the frontend, I get an saying that "You don't have the permission to view the directory or page".当我尝试从前端访问后端时,我得到一条消息“您没有查看目录或页面的权限”。

Node.js project deployment, the steps are the same, as for your unsuccessful deployment, there may be the following reasons, you can investigate: Node.js项目部署,步骤相同,至于你部署不成功,可能有以下原因,可以排查:

  1. You may need to configure the startup command after deployment, Configuration-> General settings-> Startup Command , or you can execute the startup statement command in ssh or cmd.部署后可能需要配置启动命令, Configuration-> General settings-> Startup Command ,也可以执行ssh或cmd中的启动语句命令。

    For more detail, u can refer this post .更多细节,你可以参考这篇文章 The specific command may be different, you can first execute the test in ssh or cmd.具体命令可能不同,可以先在ssh或者cmd中执行测试。 And I suggest you use choose linux to host your app.我建议您使用选择 linux 来托管您的应用程序。 Is it possible to run the npx tool to execute packages in Azure 是否可以运行 npx 工具来执行 Azure 中的包

  2. If the project uses npm install -g xxx.如果项目使用npm install -g xxx. special package for global installation.全球安装专用 package。 I suggest to check this package version in cmd or ssh.我建议在 cmd 或 ssh 中检查这个 package 版本。 If you cannot view or the prompt command does not exist, the package cannot be installed globally in the Azure Web app, that is, it cannot be started after the project is deployed.如果无法查看或提示命令不存在,则Azure Web app中无法全局安装package,即项目部署后无法启动。

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

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