简体   繁体   中英

Node.js error on Azure Web App

I have a node.js application which is running seemless on my locale machine. However i'm currently not able to make it run within azure because of the following error:

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)

I tried already several solutions since i assume the origin of the error lies within the node module version used on azure web app services. However even changing the node version to the same i have locally didn't do the trick. In addition to prevent package correlation issues with my local installs i using a npm-shrinkwrap.

Has anyone got into the same troubles and might has a solution or a hint where to look further?

This article may answer your question.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM