运行npm run dev
时,无法正确获取本地IP。
错误:监听EFAULT:系统调用参数0.0.0.0:8081中的地址错误
我知道。
1.删除node_modules下的“ cross-env”文件夹和“ cross-spawn”文件夹
2.运行npm install
3.运行npm run dev
4.错误ip更改如下。
错误:监听EFAULT:系统调用参数10.0.75.1:8081中的错误地址
Docker的IP地址是vEthernet。
PS E:\WorkSpace\my-project> npm run dev
> my-project@1.0.0 dev E:\WorkSpace\my-project
> cross-env NODE_ENV=development webpack-dev-server --open --hot
E:\WorkSpace\my-project\node_modules\webpack-dev-server\bin\webpack-dev-server.js:356
if (err) throw err;
^
Error: listen EFAULT: bad address in system call argument 10.0.75.1:8081
at Server.setupListenHandle [as _listen2] (net.js:1279:14)
at listenInCluster (net.js:1327:12)
at doListen (net.js:1460:7)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LG\AppData\Roaming\npm-cache\_logs\2019-06-11T13_23_46_070Z-debug.lo
答案 0 :(得分:0)
如果您尝试这样做:
yarn remove webpack-dev-server
yarn add webpack-dev-server@2.9.1 --dev
yarn run dev
或使用npm代替yarn