如何将使用Webpack的节点部署到heroku

我正在使用webpack。 另外我不提交npm_modules文件夹和公共文件夹,其中所有生成的文件。 我无法弄清楚如何构build我的应用程序(我有webpack构build命令)后部署和安装我的服务器(它已经在寻找公共文件夹)。 上传前提交我似乎不是一个好主意。 也许有一些温和的决定…任何想法? 分叉: 如何将使用Gulp的节点部署到heroku

我可以在heroku上设置socket.io聊天吗?

我有一个简单的socket.io聊天应用程序,我已经上传到新的Heroku'雪松'堆栈之一。 现在我几乎有所有的工作,但我已经遇到了一个绊脚石。 在我的本地主机上,我从客户端打开一个到套接字服务器的连接: // lots of HTML omitted socket = new io.Socket('localhost', {port: 8888}); 但是在Heroku上,我显然必须用别的东西替代这些值。 我可以从服务器上的过程对象获取端口,如下所示: port = process.env.PORT || 8888 并传递给视图。 但是,我用什么来代替'localhost'呢?

如何解决运行业障时“没有服务器监听端口9876”的错误?

我正在运行以下内容: PS D:\app> karma run 它显示错误: [2013-11-29 17:39:54.297] [DEBUG] config – Loading config D:\app\karma.conf.js There is no server listening on port 9876 我该如何解决?

“morgan”模块与快速应用程序有什么关系?

在一个快速教程中,作者使用了npm module morgan 。 摩根能为快递应用程序做些什么? 任何人都可以帮我理解这个吗? 通过谷歌search得到这个,但我什么都不明白在这里: var express = require('express') var morgan = require('morgan') var app = express() app.use(morgan('combined')) morgan('combined') morgan(':remote-addr :method :url') morgan(function (tokens, req, res) { return req.method + ' ' + req.url }) 提前致谢!

5个请求后,node.js http.get挂起到远程站点

我正在写一个简单的API端点来确定我的服务器是否能够连接到互联网。 它工作的很好,但经过5次请求(正好5次,每次)请求挂起。 当我将Google切换到Hotmail.com时,也会发生同样的事情,这让我觉得这是我的最终目的。 我需要closureshttp.get请求吗? 我以为这个函数自动closures请求的印象。 // probably a poor assumption, but if Google is unreachable its generally safe to say that the server can't access the internet // using this client side in the dashboard to enable/disable internet resources app.get('/api/internetcheck', function(req, res) { console.log("trying google…"); http.get("http://www.google.com", function(r){ console.log("Got status code!: " +r.statusCode.toString()); res.send(r.statusCode.toString()); res.end(); console.log("ended!"); […]

nodejs中的并发模型

有没有人知道内存和线程模型是在nodejs? 特别是ii++primefaces? 它是否像在Java 1.5,Java 1.4,C中一样volatile ?还是根本就不行?

如何让Node.JS Express只听localhost?

我有一个应用程序,我有一个反向代理,我想它只听本地/ 127.0.0.1。 我期待这个工作: app.listen(3001, 'localhost'); 要么 app.listen(3001, '127.0.0.1'); …但是,我得到一个错误: node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Cannot read property 'port' of null at Object.<anonymous> (/home/ctoledo/hive-go/go.js:204:76) at Module._compile (module.js:441:26) at Object..js (module.js:459:10) at Module.load (module.js:348:31) at Function._load (module.js:308:12) at Array.0 (module.js:479:10) at EventEmitter._tickCallback (node.js:192:40) 运行没有指定主机名的应用程序可以正常工作,即app.listen(3001); 。 我正在运行Node v0.6.14并且expression了@ 2.5.5,并且已经阅读了这个谷歌小组的讨论,并且在Express […]

节点console.log默认截断输出。 我怎样才能看到完整的输出?

节点的console.log似乎默认截断了输出,例如,查看API的输出: { '@': { xmlns: 'http://ec2.amazonaws.com/doc/2012-03-01/' }, requestId: '123456', reservationSet: { item: { reservationId: 'r-123456', ownerId: '123456', groupSet: [Object], instancesSet: [Object], requesterId: '123456' } } } 正如你所看到的, [object]没有被展开。 我想这是一个方便的措施 – 很多人不希望节点喷出数千行默认情况下。 有没有办法告诉它扩大logging的项目的内容?

Nodejssubprocess:从已经初始化的进程写入stdin

我正尝试使用节点的child_process产生一个外部进程phantomjs ,然后在初始化之后将信息发送到该进程,这可能吗? 我有以下代码: var spawn = require('child_process').spawn, child = spawn('phantomjs'); child.stdin.setEncoding = 'utf-8'; child.stdout.pipe(process.stdout); child.stdin.write("console.log('Hello from PhantomJS')"); 但是我在stdout上唯一得到的是phantomjs控制台的初始提示。 phantomjs> 所以似乎child.stdin.write没有任何效果。 我不知道我可以发送额外的信息phantomjs最初的产卵。 提前致谢。

如何从不同于我的根项目的文件夹运行grunt

有没有办法告诉咕噜哪个grunt.js文件使用? 我有一个f:\a\b\tools文件夹,其中包含grunt.cmd, node.exe,… ,我的实际web应用程序与GruntFile.js和所有本地node_modules是在f:\a\c\my_app 从a\c\my_app运行grunt工作正常,但试图从其他文件夹运行grunt说,似乎并没有工作。 我是新来的咕噜,可能是我失去了一些明显的东西。 f:\a>grunt –config c\GruntFile.js grunt-cli:咕噜的命令行界面。 (v0.1.6) 致命错误:无法find本地咕噜声。 如果你看到这个消息,Gruntfile找不到,或者Grunt没有在本地安装到你的项目中。 有关安装和configurationgrunt的更多信息,请参阅“入门指南”: http://gruntjs.com/getting-started