2017-05-17 94 views
0

我有一個node.js應用程序,它在我的語言環境機器上運行得很順暢。但是我目前沒有能夠使它蔚藍內由於以下錯誤的運行:Azure Web App上的Node.js錯誤

TypeError: Object #<Object> has no method '_extend' 
    at Function.init (D:\home\site\wwwroot\node_modules\finalhandler\node_modules\debug\src\node.js:234:28) 
    at createDebug (D:\home\site\wwwroot\node_modules\finalhandler\node_modules\debug\src\debug.js:124:13) 
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\finalhandler\index.js:14:28) 
    at Module._compile (module.js:446:26) 
    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\express\lib\application.js:16:20) 

我已經嘗試過幾種解決辦法,因爲我認爲錯誤的根源在於在Azure上的Web應用程序所使用的節點模塊版本中服務。但是,即使將節點版本更改爲相同,我本地也沒有這樣做。除了防止使用npm-shrinkwrap進行本地安裝時的軟件包相關性問題。

是否有人陷入同樣的​​困境,並可能有解決方案或暗示在哪裏看得更遠?

+0

你能提供你的'package.json'文件嗎? –

+0

嗨@AronChen你可以在這裏找到json和shrinkwrap: https://1drv.ms/u/s!AldGdcl6FYQEmbo7xRZzcoWMRFdoeQ https://1drv.ms/u/s!AldGdcl6FYQEmbo8sZFlZddxbaZMOw – rdnscr

回答

0

This article可能會回答你的問題。

Azure App Service does not support all native modules and might fail at compiling those with very specific prerequisites. Two workarounds proved successful with almost all native modules available today:

  • Run npm install on a Windows machine that has all the native module's prerequisites installed. Then, deploy the created node_modules folder as part of the application to Azure App Service.

  • Azure App Service can be configured to execute custom bash or shell scripts during deployment, giving you the opportunity to execute custom commands and precisely configure the way npm install is being run. For a video showing how to do this, see Custom Website Deployment Scripts with Kudu .