天青/ Node.js的Unaught异常:错误:无法找到模块“MS” [英] Azure/Node.js Unaught exception: Error: Cannot find module 'ms'

查看:184
本文介绍了天青/ Node.js的Unaught异常:错误:无法找到模块“MS”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署了使用Azure的发布选项在本地运行正常在Visual Studio 2015年Azure的一个小的Node.js应用程序(右键 - 发布 - 湛蓝的个人资料等)。
然而,当我访问该网站的所有我得到的页面是:

I’ve deployed a small node.js app that runs fine locally in visual studio 2015 to Azure using the Azure publish option (right click – publish – azure profile etc.). However, when I visit the site all I get on the page is:

无法显示页面,因为内部服务器错误有
  发生了。

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

如果我连接VS服务器资源管理器到Azure的实例以查看日志,日志记录,里面ERRORS.TXT我可以看到以下记录很多次:

If I connect VS server explorer up to the Azure instance to view the logs, inside logging-errors.txt I can see the following logged lots of 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)

这是通过preVIEW门户站点提供一个全新的Web应用程序。

This is a brand new web app provisioned via the preview portal.

有没有'MS'包无论是在我的项目依赖或node_modules文件夹中定义,所以我假定这是托管在Azure上需要微软/ Azure的特定的包。

There is no ‘ms’ package defined either in my project dependencies or in the node_modules folder, so I'm assuming this is a Microsoft/Azure specific package required for hosting on Azure.

我错过了在preparing的一个步骤为我的Azure应用程序的节点,或者是有一些其他的configuarion一步,我需要执行?

Have I missed a step in "preparing" my node app for Azure, or is there some other configuarion step I need to perform?

感谢

推荐答案

这看起来像是遇到了麻烦加载模块。你有一个定义你的依赖关系的文件的package.json?这天青当你部署你的网站将查找的package.json和执行 NPM安装 - 生产运行默认部署脚本。这意味着它会安装您在依赖,但不是你定义为devDependencies。

It looks like it's having trouble loading modules. Do you have a package.json file that defines your dependencies? The default deployment script that Azure runs when you deploy your site will look for a package.json and perform an npm install --production. That means it will install everything you've defined as in 'dependencies' but not the packages you've defined as 'devDependencies'.

这篇关于天青/ Node.js的Unaught异常:错误:无法找到模块“MS”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆