我的项目无法在azure中安装。我怀疑Azure正在使用 错误的节点版本和死亡。
我的设置:
1)Azure门户,应用设置,添加WEBSITE_NODE_DEFAULT_VERSION 8.9.1
2)另外,将"engines":{"node": "8.9.3"}
添加到package.json
当我从Azure门户中选择控制台时,开发工具:
节点-v
d:\家\网站\ wwwroot的
v0.10.40
kudu页面https://purple01.scm.azurewebsites.net/Env.cshtml
报告
包含正确版本和非正确版本节点的路径。
路径= D:\ Program Files(x86)\ SiteExtensions \ Kudu \ 70.10102.3204 \ bin \ NativeBinaries / amd64; D:\ home \ site \ deployments \ tools; D:\ Program Files(x86)\ SiteExtensions \ Kudu \ 70.10102.3204 \ bin \ Scripts; D:\ Program Files(x86)\ MSBuild \ 14.0 \ Bin; D:\ Program Files(x86)\ Git \ cmd; D:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow; D:\ Program Files(x86)\ Microsoft SQL Server \ 110 \ Tools \ Binn; D:\ Program Files(x86)\ Microsoft SDKs \ F#\ 3.1 \ Framework \ v4 .0; D:\ Program Files(x86)\ Git \ bin; D:\ Program Files(x86)\ Git \ usr \ bin; D:\ Program Files(x86)\ Git \ mingw32 \ bin; D:\ Program文件(x86)\ nodejs \ 0.10.28; D:\ Program Files(x86)\ npm \ 1.4.28; C:\ DWASFiles \ Sites#1purple01 \ AppData \ npm; D:\ Program Files(x86)\ bower \ 1.7.9; D:\ Program Files(x86)\ grunt \ 0.1.13; D:\ Program Files(x86)\ gulp \ 3.9.0.1; D:\ Program Files(x86)\ funcpack \ 0.2.2; D :\ Program Files(x86)\ nodejs \ 8.9.1; D:\ Windows \ system32; D:\ Windows; D:\ Windows \ System32 \ Wbem; D:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \; D :\ Program Files (x86)\ Git \ cmd; D:\ Users \ Administrator \ AppData \ Local \ Microsoft \ WindowsApps ;; D:\ Program Files(x86)\ dotnet; D:\ Windows \ system32 \ config \ systemprofile \ AppData \ Local \ Microsoft \ WindowsApps; D:\ Program Files(x86)\ PHP \ v5.6; D:\ Python27;
报告的唯一错误是在找到的文件中 ftp://waws-prod-sn1-053.ftp.azurewebsites.windows.net/LogFiles/Application/logging-errors.txt
Sat Jan 13 2018 00:53:57 GMT+0000 (Coordinated Universal Time): 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:\Program Files (x86)\iisnode\interceptor.js:459:1)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
Sat Jan 13 2018 02:17:45 GMT+0000 (Coordinated Universal Time): 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:\Program Files\iisnode\interceptor.js:459:1)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
不确定此错误是我的代码失败还是Azure代码失败。我的代码确实使用了严格的和一些像promises这样的新东西。所以我需要一个当前版本的节点。
有关Azure设置有什么问题的任何建议吗?
答案 0 :(得分:4)
App Service上没有安装节点8.9.1
,因此它默认为默认值(显然是0.10.40
)。
您可以在此处查看可用(已安装)节点引擎的列表 -
https://{sitename}.scm.azurewebsites.net/api/diagnostics/runtime
将WEBSITE_NODE_DEFAULT_VERSION
更改为8.9.3
,您应该感觉良好。
在Kudu中使用node -v
进行测试:
顺便说一下,你可以在这里查看日志流,不需要在问题上抛出FTP -
https://{sitename}.scm.azurewebsites.net/api/logstream
Azure门户中的Web应用程序下还有一个 Log Stream 刀片,它连接到同一个端点: