我使用node-ssdp来检测连接到网络的物联网设备。服务器代码和客户端代码都可以与示例节点项目一起使用。我的客户端应用程序是使用webpack作为模块捆绑器的角度电子。我用
在angular项目中安装了node-ssdpnpm install node-ssdp --save
node-ssdp
已成功安装。但是随后webpack失败并出现以下错误。
ERROR in ./~/node-ssdp/test/lib/server.js
Module not found: Error: Can't resolve 'chai' in 'J:\fyp\desktop-client\node_modules\node-ssdp\test\lib'
@ ./~/node-ssdp/test/lib/server.js 3:13-28
@ ./~/node-ssdp ^.*server$
@ ./~/node-ssdp/index.js
@ ./src/app/providers/pd.service.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts
ERROR in ./~/node-ssdp/test/lib/client.js
Module not found: Error: Can't resolve 'chai' in 'J:\fyp\desktop-client\node_modules\node-ssdp\test\lib'
@ ./~/node-ssdp/test/lib/client.js 4:13-28
@ ./~/node-ssdp ^.*client$
@ ./~/node-ssdp/index.js
@ ./src/app/providers/pd.service.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts
ERROR in ./~/node-ssdp/test/helper.js
Module not found: Error: Can't resolve 'sinon' in 'J:\fyp\desktop-client\node_modules\node-ssdp\test'
@ ./~/node-ssdp/test/helper.js 1:12-28
@ ./~/node-ssdp/test/lib/server.js
@ ./~/node-ssdp ^.*server$
@ ./~/node-ssdp/index.js
@ ./src/app/providers/pd.service.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts
ERROR in ./~/node-ssdp/test/helper.js
Module not found: Error: Can't resolve 'dgram' in 'J:\fyp\desktop-client\node_modules\node-ssdp\test'
@ ./~/node-ssdp/test/helper.js 3:12-28
@ ./~/node-ssdp/test/lib/server.js
@ ./~/node-ssdp ^.*server$
@ ./~/node-ssdp/index.js
@ ./src/app/providers/pd.service.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts
我尝试手动安装上述丢失的chai, sinon, dgram
依赖项。chai
和sinon
错误已被删除,但不是dgram
。
我曾多次尝试并浪费了几个小时。但我没有成功。有人可以建议一个解决方案吗?