Azure / Node.js Continuous Exception: Error: Cannot find module 'ms'

Ive deployed a small node.js application that works fine locally in visual studio 2015 prior to Azure using the Azure publish option (right click - publish - azure profile, etc.). However, when I visit the site, all I see on the page is:

The page cannot be displayed because an internal server error has occurred.

If I connect the VS server explorer to an Azure instance to view the logs, inside logging-errors.txt I can see the following logged many times:

Wed Jul 29 2015 12:22:36 GMT+0000 (Coordinated Universal Time): Unaught exception: Error: Cannot find module 'ms' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (D:\home\site\wwwroot\node_modules\debug\debug.js:14:20) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) 

This is a new web application provided through the preview portal.

There is no ms package defined both in the project dependencies and in the node_modules folder, so I assume that this is the Microsoft / Azure package needed to host on Azure.

Did I skip the step in β€œpreparing” my node application for Azure, or is there some other configuration step I need to complete?

thanks

+1
source share
2 answers

It looks like he has problems loading modules. Do you have a package.json file that defines your dependencies? By default, the script deployment that Azure runs when you deploy your site will search for package.json and run npm install --production . This means that it will install everything that you defined as in "dependencies", but not in packages that you defined as "devDependencies".

+1
source

To debug host applications deployed to Azure that don't start, I do:

  • Open Powershell on it scm (https: //.scm.azurewebsites.net/DebugConsole/? Shell = powershell)
  • Check if your node --version is installed correctly
  • Try starting it and look at the node.\server.js errors (or whatever is indicated in your package.json > start script.

It would be nice if you could see such a log when Azure launches the application. However, I did not find this.

0
source

All Articles