laravel 5.4 webpack.mix.js and socket.io include errors
I'm trying to use socket.io. (windows 10, node -v v6.11.0, npm -v 5.3.0).
- npm install express ioredis socket.io --save - ok.
2)my socket.js:
var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); var Redis = require('ioredis'); var fs = require('fs'); var redis = new Redis(); redis.subscribe('notification-channel', function(err, count) { }); redis.on('message', function(channel, message) { console.log('Message Recieved: ' + message); message = JSON.parse(message); io.emit(channel + ':' + message.event, message.data); }); http.listen(3000, function(){ console.log('Listening on Port 3000'); });
- npm run dev results:
ERROR Failed to compile with 2 errors 3:21:28 PM This dependency was not found:
- fs in ./~/socket.io/lib/index.js, ./~/bindings/bindings.js
To install it, you can run: npm install --save fs Asset Size Chunks Chunk Names /js/app.min.js 4.39 MB 0 [emitted] [big] /js/app.min /js/vendors.min.js 2.03 MB 1 [emitted] [big] /js/vendors.min mix-manifest.json 86 bytes [emitted]
WARNING in ./~/socket.io/lib/index.js 108:11-32 Critical dependency: the request of a dependency is an expression
WARNING in ./~/engine.io/lib/server.js 115:15-37 Critical dependency: the request of a dependency is an expression
WARNING in ./~/bindings/bindings.js 76:22-40 Critical dependency: the request of a dependency is an expression
WARNING in ./~/bindings/bindings.js
76:43-53 Critical dependency: the request of a dependency is an expression
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\hambi\AppData\Roaming\npm-cache_logs\2017-07-15T12_21_28_350Z-debug.log
How to fix it? Thanks
Please or to participate in this conversation.