当我简单的角度CLI应用程序添加一个依赖角找不到模块“净”
import {Socket} from 'net';
我得到运行时“纳克开始”
ERROR in C:/IdeaProjects/GethIPC/src/app/app.component.ts (5,20): Cannot find module 'net'
当我简单的角度CLI应用程序添加一个依赖角找不到模块“净”
import {Socket} from 'net';
我得到运行时“纳克开始”
ERROR in C:/IdeaProjects/GethIPC/src/app/app.component.ts (5,20): Cannot find module 'net'
您正尝试导入一个节点错误模块 - net
,但它在浏览器中不可用。您需要为您的客户端提供一个套接字,例如socket.io但这当然取决于你想达到什么。
谢谢。我想从角度使用应用程序geth的ipc连接。 var net = require('net'); var web3 = new Web3('/ Users/myuser/Library/Ethereum/geth.ipc',net); var web3 = new Web3(new Web3.providers.IpcProvider('/ Users/myuser/Library/Ethereum/geth.ipc',net)); –
是不是一个nodejs模块?我认为你不能在角度上使用它 –
这个nodejs模块 –
只是用'Socketio'建立一个'nodejs服务器'并用你的角度应用程序与那个服务器通信https://medium.com/@REPTILEHAUS/angular-2-and- socket-io-chat-app-f56afb9ceeb2 https://github.com/jussikinnula/angular-socket-io-chat – Kuncevic