ERROR in (webpack)-dev-server/~/express/~/send/~/destroy/index.js
Module not found: Error: Cannot resolve module 'fs' in /home/tigerb/github/easy-vue/node_modules/webpack-dev-server/node_modules/express/node_modules/send/node_modules/destroy
@ (webpack)-dev-server/~/express/~/send/~/destroy/index.js 14:17-30
ERROR in (webpack)-dev-server/~/sockjs/~/faye-websocket/lib/faye/websocket/client.js
Module not found: Error: Cannot resolve module 'net' in /home/tigerb/github/easy-vue/node_modules/webpack-dev-server/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket
@ (webpack)-dev-server/~/sockjs/~/faye-websocket/lib/faye/websocket/client.js 2:10-24
ERROR in (webpack)-dev-server/~/sockjs/~/faye-websocket/lib/faye/websocket/client.js
Module not found: Error: Cannot resolve module 'tls' in /home/tigerb/github/easy-vue/node_modules/webpack-dev-server/node_modules/sockjs/node_modules/faye-websocket/lib/faye/websocket
@ (webpack)-dev-server/~/sockjs/~/faye-websocket/lib/faye/websocket/client.js 3:10-24
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
在webpack.config中加上
详见:webpack wiki
确保本地
node_moudles下已经安装了问题中提到的三个模块。如果
package.json中有定义这个依赖,直接npm i即可这三个模块是nodejs内置的,不该打包的,你看下哪里引用到了
我同意angola的观点,我也遇到了这个问题。但可以肯定的是fs是内置的模块。检查一下是否有符号错误。
肯定是你前端用了后端的库。我遇到过,在react里引入require('NET') net是服务端的api。所以报错。
net库和fs库都是chrome的v8引擎之外的写给nodejs用的。是用在服务端,而不是浏览器你的前端,你在前端渲染。肯定就加载不了这个模块了。我这样认为。
我在使用scss-loader也出现了这个问题,
node: {
fs: "empty"
}
添加了这个以后,直接跳过了编译,确实不报错了,你解决了吗?