Laravel框架5.8.31 NPM 6.4.1 节点v8.16.0
我需要在laravel项目中运行ICMP ping。
我正在尝试使用ping https://www.npmjs.com/package/ping或net-ping https://www.npmjs.com/package/net-ping之类的软件包
安装它们并运行: npm安装ping npm install net-ping
然后编辑bootstrap.js:
var Ping = require('ping'); var NetPing = require('net-ping');
然后...
npm run dev
ping错误
This dependency was not found:
* child_process in ./node_modules/ping/lib/ping-promise.js
ERROR in ./node_modules/ping/lib/ping-promise.js
Module not found: Error: Can't resolve 'child_process' in '/var/www/html/laravel/ipam/node_modules/ping/lib'
@ ./node_modules/ping/lib/ping-promise.js 15:9-33
@ ./node_modules/ping/index.js
@ ./resources/js/bootstrap.js
@ ./resources/js/app.js
@ multi ./resources/js/app.js ./resources/sass/app.scss
安装子进程(+ child_process@1.0.2)但没有运气
net-ping错误(它使用原始套接字)
ERROR in ./node_modules/raw-socket/build/Release/raw.node 1:0
Module parse failed: Unexpected character ' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
@ ./node_modules/raw-socket/index.js 4:10-46
@ ./node_modules/net-ping/index.js
@ ./resources/js/bootstrap.js
@ ./resources/js/app.js
@ multi ./resources/js/app.js ./resources/sass/app.scss
我一直在寻找解决方案,但是没有运气。