如何在Cloud9 IDE中使用grunt服务? [英] How to use grunt serve in Cloud9 IDE?
问题描述
connect:{
options:{
port:process.env.PORT,
hostname:process.env.IP,
livereload:35729
}
}
我尝试从Cloud 9终端运行,得到以下结果:
运行服务任务
运行concurrent:server(concurrent)task
运行connect:livereload(连接)任务致命错误:端口8080是
已被另一进程使用。
然后我将Gruntfile.js更改为以下内容:
connect:{
options:{
port:9000,
hostname:process.env.IP,
livereload:35729
}
}
从终端获得:
运行serve任务
运行concurrent:server(并发)ta sk
运行connect:livereload(connect)任务开始连接web服务器
http://0.0.0.0:9000
运行监视任务正在等待...
但是,如何从Cloud 9访问 http://0.0.0.0:9000
?
我试过 http:// localhost:9000
, http://127.0.0.1:9000
,我在这里丢失了什么?
在Cloud9上,您可以使用端口8080, 8081和8082来完成这项工作。有关详情和示例,您可以查看多个端口。
在Cloud9中,端口8080是唯一可从外部访问的端口,因此请将9000更改为8080.
端口正在被另一个过程,应该先停止。使用:
kill -9 $(lsof -i:8080 -t)
并重新启动grunt。这将起作用。
In my Gruntfile.js I have tried to do this:
connect: {
options: {
port: process.env.PORT,
hostname: process.env.IP,
livereload: 35729
}
}
I tried to run from Cloud 9 terminal and I get the following:
Running "serve" task
Running "concurrent:server" (concurrent) task
Running "connect:livereload" (connect) task Fatal error: Port 8080 is already in use by another process.
Then I have changed my Gruntfile.js to the following:
connect: {
options: {
port: 9000,
hostname: process.env.IP,
livereload: 35729
}
}
From the terminal I get:
Running "serve" task
Running "concurrent:server" (concurrent) task
Running "connect:livereload" (connect) task Started connect web server on
http://0.0.0.0:9000
Running "watch" task Waiting...
But how do I access http://0.0.0.0:9000
from Cloud 9?
I have tried http://localhost:9000
, http://127.0.0.1:9000
, am I missing something here?
Update: On Cloud9, you can use ports 8080, 8081, and 8082 to make this work. For details and an example, you can look at Multiple Ports.
In Cloud9, port 8080 is the only externally accessible port, so please change 9000 to 8080. The port is in use by another process, which should be stopped first. Use:
kill -9 $(lsof -i:8080 -t)
and restart grunt. That will work.
这篇关于如何在Cloud9 IDE中使用grunt服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!