1

我想在我的 node.js 应用程序中使用“socket.io-servicebus”模块。

但是我遇到了一个问题。安装“socket.io-servicebus”后,“Publish-AzureServiceProject”命令未创建 cloud_package.cspkg 文件。

我在 Windows7 64 位版本上使用“Windows Azure PowerShell”。

这是程序。

  • 新 AzureServiceProject 测试1
  • 添加-AzureNodeWebRole www
  • 光盘 www
  • npm install socket.io-servicebus
  • 发布-AzureServiceProject -ServiceName xxx ...

    [ cloud_package.cspkg 不会创建]

顺便说一句“Start-AzureEmulator -Launch"会成功,我们可以测试自己的应用程序。

请给我一些建议。谢谢你。

4

1 回答 1

-1

It looks like the issue here is due to a known path length limitation. Azure has a limitation on paths in the package being more than 255 chars and in this case bringing in socket.io WITH all of it's dependencies is hitting that path.

There are several possible work arounds here.

A. - Zip up node modules and extract on the server.

Basically you zip up your modules and publish the module zip within the package. Then you can use an Azure startup task (in your cscfg) on the server to unzip the files.

Publish-AzureServicePackage will grab anything in the project, so in this case you just have a little script that you run before publishing which creates the node_modules archive and deletes node_modules.

I am planning to do a blog post on this, but it is actually relatively easy to do.

B. - Download node modules dynamically

You can download modules in the cloud. This can also be done with a startup task as is shown here.

If you look in that post you will see how you can author a startup task if you decide to do the archive route.

Feel free to ping me with any questions.

于 2013-05-17T22:29:06.587 回答