Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在严格模式下使用常量:Azure Web App 应用程序引发了未捕获的异常并被终止:SyntaxError:在严格模式下使用const。 在模块处编译(Module.js:434:25) at Object..js(module.js:464:10) 在Module.load(Module.js:353:31) at函数。_加载(module.js:311:12) at Module.require(Module.js:359:17) 根据需要(模块js:375:17) 反对。(D:\home\site\wwwroot\node\u modules\mongoose\index.js:7:18) 在模块处编译(Module.js:446:26) at Object..js(module.js:464:10) 在Module.load(Module.js:353:31)_Node.js_Azure_Azure Web App Service - Fatal编程技术网

Node.js 在严格模式下使用常量:Azure Web App 应用程序引发了未捕获的异常并被终止:SyntaxError:在严格模式下使用const。 在模块处编译(Module.js:434:25) at Object..js(module.js:464:10) 在Module.load(Module.js:353:31) at函数。_加载(module.js:311:12) at Module.require(Module.js:359:17) 根据需要(模块js:375:17) 反对。(D:\home\site\wwwroot\node\u modules\mongoose\index.js:7:18) 在模块处编译(Module.js:446:26) at Object..js(module.js:464:10) 在Module.load(Module.js:353:31)

Node.js 在严格模式下使用常量:Azure Web App 应用程序引发了未捕获的异常并被终止:SyntaxError:在严格模式下使用const。 在模块处编译(Module.js:434:25) at Object..js(module.js:464:10) 在Module.load(Module.js:353:31) at函数。_加载(module.js:311:12) at Module.require(Module.js:359:17) 根据需要(模块js:375:17) 反对。(D:\home\site\wwwroot\node\u modules\mongoose\index.js:7:18) 在模块处编译(Module.js:446:26) at Object..js(module.js:464:10) 在Module.load(Module.js:353:31),node.js,azure,azure-web-app-service,Node.js,Azure,Azure Web App Service,每次创建Azure Web App项目并发布Express App时都会引发错误。我试着用Azure Express和Blank nodeJs应用程序来做这件事看起来这是由Azure上的无效节点版本引起的。转到Azure门户,您的Web应用程序-应用程序设置,检查网站\节点\默认\版本 一旦我们指定了Azure上不可用的版本,就会使用非常旧的版本0.10.40,其中默认情况下未启用const,因此我们遇到了SyntaxError:在严格模式下使用const。有关更多详细信息,请参阅 我们可以使

每次创建Azure Web App项目并发布Express App时都会引发错误。我试着用Azure Express和Blank nodeJs应用程序来做这件事

看起来这是由Azure上的无效节点版本引起的。转到Azure门户,您的Web应用程序-应用程序设置,检查
网站\节点\默认\版本

一旦我们指定了Azure上不可用的版本,就会使用非常旧的版本0.10.40,其中默认情况下未启用
const
,因此我们遇到了
SyntaxError:在严格模式下使用const
。有关更多详细信息,请参阅

我们可以使用10.6.0、8.11.1等。转到
https://.scm.azurewebsites.net/api/diagnostics/runtime
查看所有可用版本

克林克兹的警告

在某些情况下,上述解决方案可能不起作用。这可能是因为您的项目包含文件
iisnode.yml
。如果此文件存在,它将覆盖应用程序设置环境变量。该文件的内容应如下所示:

Application has thrown an uncaught exception and is terminated: SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:434:25)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\mongoose\index.js:7:18)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
此处指定的节点版本采用precendence。要解决此问题,只需更新版本,如这样,然后部署:

nodeProcessCommandLine: "%SystemDrive%\Program Files (x86)\nodejs\0.10.4\node.exe"
参考



总之,优先级为:iisnode.yml>package.json(引擎)>应用程序设置。建议使用应用程序设置,因为它很容易在门户上检查和修改。

我对这个答案有一个补充。我已经编辑了这个帖子,请考虑接受。
nodeProcessCommandLine: "%SystemDrive%\Program Files (x86)\nodejs\8.9.4\node.exe"