简体   繁体   中英

Angular cannot find module 'net'

When I added a dependency in simple Angular CLI app

import {Socket} from 'net';

I get error when run 'ng start'

ERROR in C:/IdeaProjects/GethIPC/src/app/app.component.ts (5,20): Cannot find module 'net'

You are trying to import a node module - net , but it is not available in the browser. You'll need a socket for your client, eg socket.io but that of course depends on what you want to achieve.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM