node.js - 缺少 server.js/app.js 文件,未生成 web.config

标签 node.js git azure-mobile-services

我正在使用 Windows Azure 移动服务的源代码控制功能来推送自定义 API 脚本。

我做了什么:

  1. 克隆了 git 存储库。 (它包含一堆目录,其中包含解释内容的 readme.md 文件,以及一些用于现有表权限的配置文件。)
  2. 添加了 service/api/test.jsservice/api/test.json 文件(自定义 API 脚本和配置)。
  3. 已提交更改并将更改推送到远程。

我从 git 得到了以下输出:

remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '1cbfbd5ac1'.
remote: Running custom deployment command...
remote: Running deployment command...
remote: Handling Basic Web Site deployment.
remote: KuduSync.NET from: 'D:\home\site\repository\service' to: 'D:\home\site\wwwroot\App_Data\config\scripts'
remote: Copying file: 'api\test.js'
remote: Copying file: 'api\test.json'
remote: Missing server.js/app.js files, web.config is not generated
remote: Node.js versions available on the platform are: 0.6.17, 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.10.5, 0.10.18, 0.10.21, 0.10.24.
remote: Selected node.js version 0.10.24. Use package.json file to choose a different version.
remote: npm WARN package.json myservice@1.0.0 No repository field.
remote: npm WARN package.json myservice@1.0.0 No README data
remote: Finished successfully.
remote: Deployment successful.

现在,当我尝试通过标准 API 访问任何现有表(例如发布到 https://myservice.azure-mobile.net/tables/MyTable)时,我会得到一个500 内部服务器错误。

我认为上面输出中的这一行与它有关:

远程:缺少 server.js/app.js 文件,未生成 web.config

但是,git 存储库中从未包含任何 server.jsapp.js,我不知道这些文件应该包含什么,因为似乎有文档中没有提及这些文件。

最佳答案

事实证明,此错误消息不是罪魁祸首:

remote: Missing server.js/app.js files, web.config is not generated

像一个优秀的程序员一样,我将配置信息放在<PROJECT_ROOT>/shared/config.json中。当我检查日志时,它提示路由配置不正确。该文档暗示只有 <PROJECT_ROOT>/api包含自定义路由,所以我不知道为什么它在文档明确指出共享目录专门用于表和自定义API脚本使用的共享代码的情况下将共享目录中的JSON文件解释为路由配置。

config.json 更改后至config.js并进行必要的代码更改,一切又开始工作了。

我仍然收到有关缺少 server.js/app.js 文件的警告,但它似乎没有影响任何内容。

结论:除了 readme.md 中指定的之外,请勿将 JSON 文件添加到 Azure 移动服务脚本中。最初与脚本捆绑在一起的文件。

关于node.js - 缺少 server.js/app.js 文件,未生成 web.config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21743041/

相关文章:

node.js - 唯一和稀疏索引导致重复错误

java - Maven 发布插件将标签推送到错误的 repo

git - DVCS如何帮助科学编程?

javascript - 如何在服务器脚本中从另一个表中选择数据?微软Azure

ios - 从 SyncTable 拉取更新核心数据对象,而不是调用 NSFeatchedResults 委托(delegate)方法

node.js - Google Cloud Storage - 如何在 Node.JS 中接收特定生成的文件

Node.js 错误 : Unexpected field

javascript - 如何从 Windows Azure 服务器脚本中插入的项目中获取自动生成的 ID?

javascript - Node.js https.get.on ("error",函数(e){...} 不工作

git - 为什么 HEAD 在 master 之前?