Azure和MicrosoftGraph Api部署抛出“错误:不允许的方法”

时间:2018-12-11 17:31:19

标签: javascript node.js azure azure-web-sites microsoft-graph

我想以天蓝色部署应用程序Web服务,但是我遇到的问题是,如果我添加依赖于Microsoft图形api,则当我更新git并继续进行部署时,服务器将返回“错误:方法不允许”。

这是应用github(它是我用来测试的一个简单的helloWorld应用): https://github.com/ricardoGuerreroAvantica/test_azure_helloworld

这是我在部署中得到的错误日志:

Command: "D:\home\site\deployments\tools\deploy.cmd".

Handling node.js deployment.
Creating app_offline.htm
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'package-lock.json'
Copying file: 'package.json'
Deleting app_offline.htm
Looking for app.js/server.js under site root.
Using start-up script app.js
Generated web.config.
The package.json file does not specify node.js engine version constraints.
The node.js application will run with the default node.js version 0.10.40.
Selected npm version 1.4.28
npm WARN package.json setimmediate@1.0.5 No README data
npm WARN package.json bcrypt-pbkdf@1.0.1 No repository field.
npm WARN package.json punycode@2.1.0 punycode is also the name of a node core module.
npm WARN package.json path@0.12.7 path is also the name of a node core module.
npm WARN package.json pause@0.0.1 No repository field.
npm WARN package.json util@0.10.3 util is also the name of a node core module.
npm WARN package.json string_decoder@1.0.3 string_decoder is also the name of a node core module.
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-named.js:260:10)
npm ERR!     at D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-named.js:203:12
npm ERR!     at saved (D:\Program Files (x86)\npm\1.4.28\node_modules\npm\node_modules\npm-registry-client\lib\get.js:167:7)
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\0.10.40\node.exe" "D:\Program Files (x86)\npm\1.4.28\node_modules\npm\bin\npm-cli.js" install --production
npm ERR!     at Object.oncomplete (fs.js:108:15)
An error has occurred during web site deployment.
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "D:\\Program Files (x86)\\nodejs\\0.10.40\\node.exe" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
npm ERR! cwd D:\home\site\wwwroot
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code E405
npm WARN package.json setimmediate@1.0.5 No README data\r\nnpm WARN package.json bcrypt-pbkdf@1.0.1 No repository field.\r\nnpm WARN package.json punycode@2.1.0 punycode is also the name of a node core module.\r\nnpm WARN package.json path@0.12.7 path is also the name of a node core module.\r\nnpm WARN package.json pause@0.0.1 No repository field.\r\nnpm WARN package.json util@0.10.3 util is also the name of a node core module.\r\nnpm WARN package.json string_decoder@1.0.3 string_decoder is also the name of a node core module.\r\nnpm ERR! Error: Method Not Allowed\r\nnpm ERR!     at errorResponse (D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-named.js:260:10)\r\nnpm ERR!     at D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-named.js:203:12\r\nnpm ERR!     at saved (D:\Program Files (x86)\npm\1.4.28\node_modules\npm\node_modules\npm-registry-client\lib\get.js:167:7)\r\nnpm ERR!     at Object.oncomplete (fs.js:108:15)\r\nnpm ERR! If you need help, you may report this *entire* log,\r\nnpm ERR! including the npm and node versions, at:\r\nnpm ERR!     <http://github.com/npm/npm/issues>\r\n\r\nnpm ERR! System Windows_NT 6.2.9200\r\nnpm ERR! command "D:\\Program Files (x86)\\nodejs\\0.10.40\\node.exe" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"\r\nnpm ERR! cwd D:\home\site\wwwroot\r\nnpm ERR! node -v v0.10.40\r\nnpm ERR! npm -v 1.4.28\r\nnpm ERR! code E405\r\nD:\Program Files (x86)\SiteExtensions\Kudu\79.11121.3655\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

1 个答案:

答案 0 :(得分:2)

根据您的错误信息,您正在将应用程序部署到导致问题的Azure WebApp的默认node.js版本0.10.40上,因为您的应用程序依赖的msgraph-sdk-javascript程序包需要NodeJS更高版本

正如GitHub Repo README.md所说,它已经过v6.9.1的测试,因此您可以通过添加记录WEBSITE_NODE_DEFAULT_VERSION和{{1}来升级Azure WebApp的Node版本。 },如下图所示,来自我对类似SO线程Kudu npm install failed的回答,也可以参考。

enter image description here