找不到模块“laravel回声”

问题描述:

我学习到配置Laravel回声Socket.js和following an article here找不到模块“laravel回声”

守则bootstrap.js低于

import Echo from "laravel-echo" 

window.Echo = new Echo({ 
    broadcaster: 'socket.io', 
    host: window.location.hostname + ':6001' 
}); 

当我运行上面的代码,它说,找不到模块“laravel-echo”

我没有使用推杆和redis。在上面的参考页面中,我认为,没有给出只有socket.io的安装指南

有人可以解释我是否缺少任何东西?

我需要安装下面的包。

npm install -g laravel-echo-server 

then following the step by step instruction as give here

最后把下面的代码任何js文件之前。

<script src="http://{{ Request::getHost() }}:6001/socket.io/socket.io.js"></script>